Skip to content

Commit

Permalink
make unit test stricter, update version
Browse files Browse the repository at this point in the history
  • Loading branch information
shaan420 committed Oct 3, 2023
1 parent 0c4e7fe commit 7bb497c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions m3/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,28 @@ func TestReporterCommmonTagsInternal(t *testing.T) {
require.NoError(t, err)
defer r.Close()

wg.Add(internalMetrics)
c := r.AllocateCounter("testCounter1", nil)
c.ReportCount(1)
wg.Add(internalMetrics + 1)
r.Flush()
wg.Wait()

numInternalMetricsActual := 0
metrics := server.Service.getMetrics()
require.Equal(t, internalMetrics, len(metrics))
require.Equal(t, internalMetrics+1, len(metrics))
for _, metric := range metrics {
require.True(t, strings.HasPrefix(metric.Name, "tally.internal"))
for k, v := range commonTagsInternal {
require.True(t, tagEquals(metric.Tags, k, v))
if strings.HasPrefix(metric.Name, "tally.internal") {
numInternalMetricsActual++
for k, v := range commonTagsInternal {
require.True(t, tagEquals(metric.Tags, k, v))
}
} else {
require.Equal(t, "testCounter1", metric.Name)
require.False(t, tagIncluded(metric.Tags, "internal1"))
require.False(t, tagIncluded(metric.Tags, "internal2"))
}
}
require.Equal(t, internalMetrics, numInternalMetricsActual)
}

func TestReporterHasReportingAndTaggingCapability(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
package tally

// Version is the current version of the library.
const Version = "4.1.8"
const Version = "4.1.9"

0 comments on commit 7bb497c

Please sign in to comment.