Skip to content

Commit

Permalink
add test case for Count scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
ajatprabha committed Jul 1, 2019
1 parent 731b964 commit 0d95358
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/metrics/statsd_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func TestUpdate(t *testing.T) {
mock.AnythingOfType("float32")).Return(nil)
Update(UpdateOption{Type: Duration, Duration: time.Since(now)})

mc.On("Inc",
mock.AnythingOfType("string"),
mock.AnythingOfType("int64"),
mock.AnythingOfType("float32")).Return(nil)
Update(UpdateOption{Type: Count})

// error case
mc.On("Gauge",
mock.AnythingOfType("string"),
Expand All @@ -57,8 +63,9 @@ type mockStatsdClient struct {
mock.Mock
}

func (msc *mockStatsdClient) Inc(string, int64, float32) error {
panic("implement me")
func (msc *mockStatsdClient) Inc(str string, i int64, sr float32) error {
args := msc.Called(str, i, sr)
return args.Error(0)
}

func (msc *mockStatsdClient) Dec(string, int64, float32) error {
Expand Down

0 comments on commit 0d95358

Please sign in to comment.