Skip to content

Commit

Permalink
Add MockCWService for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Dec 13, 2024
1 parent 0444041 commit fb183c8
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions aws/cwatch/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,3 @@ type CWService interface {
}

var _ CWService = (*Service)(nil)

type MockCWService struct {
namespace string
deployment types.Dimension
Batcher []types.MetricDatum

Stopped bool
}

func NewMockCWService(accessKey, secretKey, region, namespace, deployment string) (*MockCWService, error) {
mockCW := MockCWService{
namespace: namespace,
deployment: types.Dimension{Name: aws.String("Deployment"), Value: aws.String(deployment)},
Batcher: nil,
}

return &mockCW, nil
}

func (s *MockCWService) Queue(d types.MetricDatum) {
if s.Stopped {
return
}
s.Batcher = append(s.Batcher, d)
}

func (s *MockCWService) StartQueue(wg *sync.WaitGroup) {
s.Batcher = []types.MetricDatum{}
}

func (s *MockCWService) StopQueue() {
s.Stopped = true
}

0 comments on commit fb183c8

Please sign in to comment.