Skip to content

Commit

Permalink
test: fix flaky label test
Browse files Browse the repository at this point in the history
Sort order in JSON is not guaranteed.
  • Loading branch information
Stebalien committed Apr 17, 2021
1 parent aa7b97a commit ef16ad7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TestLogLabels(t *testing.T) {
}()

// set the go-log labels env var
os.Setenv(envLoggingLabels, "app=example_app,dc=sjc-1,foobar") // foobar to ensure we don't panic on bad input.
os.Setenv(envLoggingLabels, "dc=sjc-1,foobar") // foobar to ensure we don't panic on bad input.
defer os.Unsetenv(envLoggingLabels)
SetupLogging(configFromEnv())

Expand All @@ -154,7 +154,7 @@ func TestLogLabels(t *testing.T) {
}

t.Log(buf.String())
if !strings.Contains(buf.String(), "{\"app\": \"example_app\", \"dc\": \"sjc-1\"}") {
if !strings.Contains(buf.String(), "{\"dc\": \"sjc-1\"}") {
t.Errorf("got %q, wanted it to contain log output", buf.String())
}
}
Expand Down

0 comments on commit ef16ad7

Please sign in to comment.