-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to mock metrics and fix their handling (#26)
Signed-off-by: Igor Shishkin <me@teran.dev>
- Loading branch information
Showing
5 changed files
with
125 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package service | ||
|
||
import ( | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
var _ Metrics = (*MetricsMock)(nil) | ||
|
||
type MetricsMock struct { | ||
mock.Mock | ||
} | ||
|
||
func NewMetricsMock() *MetricsMock { | ||
return &MetricsMock{} | ||
} | ||
|
||
func (m *MetricsMock) ServiceUp(service string) { | ||
m.Called(service) | ||
} | ||
|
||
func (m *MetricsMock) ServiceDown(service string) { | ||
m.Called(service) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters