diff --git a/aws/cwatch/service.go b/aws/cwatch/service.go index 44b1077..b31780c 100644 --- a/aws/cwatch/service.go +++ b/aws/cwatch/service.go @@ -79,3 +79,36 @@ 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 +}