Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix TestValidateTags #173

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func TestValidateTags(t *testing.T) {
store.Flush()

expected := "test:1|c"
counter := sink.record
if !strings.Contains(counter, expected) {
t.Error("wanted counter value of test:1|c, got", counter)
output := sink.record
if !strings.Contains(output, expected) && !strings.Contains(output, "reserved_tag") {
t.Errorf("Expected without reserved tags: '%s' Got: '%s'", expected, output)
}

// A reserved tag should trigger adding the reserved_tag counter
Expand All @@ -89,10 +89,11 @@ func TestValidateTags(t *testing.T) {
store.NewCounterWithTags("test", map[string]string{"host": "i"}).Inc()
store.Flush()

expected = "reserved_tag:1|c\ntest.__host=i:1|c"
counter = sink.record
if !strings.Contains(counter, expected) {
t.Error("wanted counter value of test.___f=i:1|c, got", counter)
expected = "test.__host=i:1|c"
expectedReservedTag := "reserved_tag:1|c"
output = sink.record
if !strings.Contains(output, expected) && !strings.Contains(output, expectedReservedTag) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

determined the order of data in this output is not deterministic. let's not assume it is in this test

t.Errorf("Expected: '%s' and '%s', In: '%s'", expected, expectedReservedTag, output)
}
}

Expand Down
Loading