Skip to content

Commit

Permalink
make clearer which the SUT is
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanotorresi committed Jul 10, 2020
1 parent 520d0ea commit d5af7f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions collector/instrumented_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func TestInstrumentedCollector(t *testing.T) {
mockCollector.EXPECT().Describe(gomock.Any())
mockCollector.EXPECT().CollectWithError(gomock.Any())

ic := NewInstrumentedCollector(mockCollector)
ic.Clock = &clock.StoppedClock{}
SUT := NewInstrumentedCollector(mockCollector)
SUT.Clock = &clock.StoppedClock{}

metrics := `# HELP ha_cluster_scrape_duration_seconds Duration of a collector scrape.
# TYPE ha_cluster_scrape_duration_seconds gauge
Expand All @@ -40,7 +40,7 @@ ha_cluster_scrape_duration_seconds{collector="mock_collector"} 1.234
ha_cluster_scrape_success{collector="mock_collector"} 1
`

err := testutil.CollectAndCompare(ic, strings.NewReader(metrics))
err := testutil.CollectAndCompare(SUT, strings.NewReader(metrics))
assert.NoError(t, err)
}

Expand All @@ -56,14 +56,14 @@ func TestInstrumentedCollectorScrapeFailure(t *testing.T) {
mockCollector.EXPECT().Describe(gomock.Any())
mockCollector.EXPECT().CollectWithError(gomock.Any()).Return(errors.New("test error"))

ic := NewInstrumentedCollector(mockCollector)
SUT := NewInstrumentedCollector(mockCollector)

metrics := `# HELP ha_cluster_scrape_success Whether a collector succeeded.
# TYPE ha_cluster_scrape_success gauge
ha_cluster_scrape_success{collector="mock_collector"} 0
`

err := testutil.CollectAndCompare(ic, strings.NewReader(metrics), "ha_cluster_scrape_success")
err := testutil.CollectAndCompare(SUT, strings.NewReader(metrics), "ha_cluster_scrape_success")
assert.NoError(t, err)

assert.Len(t, logHook.Entries, 1)
Expand Down

0 comments on commit d5af7f4

Please sign in to comment.