Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmk committed Nov 7, 2024
1 parent acb4e96 commit 09c0060
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions surveyor/surveyor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"io"
"net/http"
"os"
"regexp"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -326,23 +327,23 @@ func TestSurveyor_AccountJetStreamAssets(t *testing.T) {
t.Fatal(err)
}

want := []string{
"nats_core_account_bytes_recv",
"nats_core_account_bytes_sent",
"nats_core_account_conn_count",
"nats_core_account_count",
"nats_core_account_jetstream_enabled",
`nats_core_account_jetstream_stream_count{account="JS"} 10`,
`nats_core_account_jetstream_consumer_count{account="JS",stream="repl1"} 5`,
`nats_core_account_jetstream_consumer_count{account="JS",stream="repl2"} 5`,
`nats_core_account_jetstream_consumer_count{account="JS",stream="single1"} 5`,
`nats_core_account_jetstream_tiered_storage_used{account="JS",tier="R1"}`,
`nats_core_account_jetstream_tiered_storage_used{account="JS",tier="R3"}`,
`nats_core_account_jetstream_tiered_storage_reserved{account="JS",tier="R1"}`,
`nats_core_account_jetstream_tiered_storage_reserved{account="JS",tier="R3"}`,
want := []*regexp.Regexp{
regexp.MustCompile(`nats_core_account_bytes_recv`),
regexp.MustCompile(`nats_core_account_bytes_sent`),
regexp.MustCompile(`nats_core_account_conn_count`),
regexp.MustCompile(`nats_core_account_count`),
regexp.MustCompile(`nats_core_account_jetstream_enabled`),
regexp.MustCompile(`nats_core_account_jetstream_stream_count\{account="JS"} 10`),
regexp.MustCompile(`nats_core_account_jetstream_consumer_count\{account="JS",raft_group="[^"]+",stream="repl1"} 5`),
regexp.MustCompile(`nats_core_account_jetstream_consumer_count\{account="JS",raft_group="[^"]+",stream="repl2"} 5`),
regexp.MustCompile(`nats_core_account_jetstream_consumer_count\{account="JS",raft_group="[^"]+",stream="single1"} 5`),
regexp.MustCompile(`nats_core_account_jetstream_tiered_storage_used\{account="JS",tier="R1"}`),
regexp.MustCompile(`nats_core_account_jetstream_tiered_storage_used\{account="JS",tier="R3"}`),
regexp.MustCompile(`nats_core_account_jetstream_tiered_storage_reserved\{account="JS",tier="R1"}`),
regexp.MustCompile(`nats_core_account_jetstream_tiered_storage_reserved\{account="JS",tier="R3"}`),
}
for _, m := range want {
if !strings.Contains(output, m) {
if !m.MatchString(output) {
t.Logf("output: %s", output)
t.Fatalf("missing: %s", m)
}
Expand Down

0 comments on commit 09c0060

Please sign in to comment.