Skip to content

Commit

Permalink
Fix test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
trvrnrth committed Sep 12, 2022
1 parent a632d31 commit 1837b57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions exporter/replset_status_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ func TestReplsetStatusCollector(t *testing.T) {

// The last \n at the end of this string is important
expected := strings.NewReader(`
# HELP mongodb_myState myState
# TYPE mongodb_myState untyped
mongodb_myState 1
# HELP mongodb_ok ok
# TYPE mongodb_ok untyped
mongodb_ok 1` + "\n")
# HELP mongodb_rs_myState replSetGetStatus.
# TYPE mongodb_rs_myState untyped
mongodb_rs_myState 1
# HELP mongodb_rs_ok replSetGetStatus.
# TYPE mongodb_rs_ok untyped
mongodb_rs_ok 1` + "\n")
// Filter metrics for 2 reasons:
// 1. The result is huge
// 2. We need to check against know values. Don't use metrics that return counters like uptime
// or counters like the number of transactions because they won't return a known value to compare
filter := []string{
"mongodb_myState",
"mongodb_ok",
"mongodb_rs_myState",
"mongodb_rs_ok",
}
err := testutil.CollectAndCompare(c, expected, filter...)
assert.NoError(t, err)
Expand Down
16 changes: 8 additions & 8 deletions exporter/serverstatus_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ func TestServerStatusDataCollector(t *testing.T) {

// The last \n at the end of this string is important
expected := strings.NewReader(`
# HELP mongodb_mem_bits mem.
# TYPE mongodb_mem_bits untyped
mongodb_mem_bits 64
# HELP mongodb_metrics_commands_connPoolSync_failed metrics.commands.connPoolSync.
# TYPE mongodb_metrics_commands_connPoolSync_failed untyped
mongodb_metrics_commands_connPoolSync_failed 0` + "\n")
# HELP mongodb_ss_mem_bits serverStatus.mem.
# TYPE mongodb_ss_mem_bits untyped
mongodb_ss_mem_bits 64
# HELP mongodb_ss_metrics_commands_connPoolSync_failed serverStatus.metrics.commands.connPoolSync.
# TYPE mongodb_ss_metrics_commands_connPoolSync_failed untyped
mongodb_ss_metrics_commands_connPoolSync_failed 0` + "\n")
// Filter metrics for 2 reasons:
// 1. The result is huge
// 2. We need to check against know values. Don't use metrics that return counters like uptime
// or counters like the number of transactions because they won't return a known value to compare
filter := []string{
"mongodb_mem_bits",
"mongodb_metrics_commands_connPoolSync_failed",
"mongodb_ss_mem_bits",
"mongodb_ss_metrics_commands_connPoolSync_failed",
}
err := testutil.CollectAndCompare(c, expected, filter...)
assert.NoError(t, err)
Expand Down

0 comments on commit 1837b57

Please sign in to comment.