public async Task WhenDryRunQueueLengthAlarmIsNotPut() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); var logger = new Mock <IAlarmLogger>(); var queueAlarmCreator = new QueueAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); await queueAlarmCreator.EnsureLengthAlarm("testQueue", 10, "suffix", "testArn", true); VerifyCloudwatch.PutMetricAlarmWasNotCalled(cloudWatch); }
public async Task TestBasicQueueLengthAlarmCreation() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); var logger = new Mock <IAlarmLogger>(); var queueAlarmCreator = new QueueAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); await queueAlarmCreator.EnsureLengthAlarm("testQueue", 10, "suffix", "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenQueueLengthAlarmExistsWithDifferentPeriodAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 10, AwsConstants.FiveMinutesInSeconds + 1, "testArn"); var logger = new Mock <IAlarmLogger>(); var queueAlarmCreator = new QueueAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); await queueAlarmCreator.EnsureLengthAlarm("testQueue", 10, "suffix", "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenOldestMessageAlarmExistsWithDifferentThresholdAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 101, AwsConstants.FiveMinutesInSeconds, "testArn"); var logger = new Mock <IAlarmLogger>(); var queueAlarmCreator = new QueueAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); await queueAlarmCreator.EnsureOldestMessageAlarm("testQueue", 100, "suffix", "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenOldestMessageAlarmExistsAtSameLevelNoAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 100, AwsConstants.FiveMinutesInSeconds, "testArn"); var logger = new Mock <IAlarmLogger>(); var queueAlarmCreator = new QueueAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); await queueAlarmCreator.EnsureOldestMessageAlarm("testQueue", 100, "suffix", "testArn", false); VerifyCloudwatch.PutMetricAlarmWasNotCalled(cloudWatch); }