public async Task TestBasicWriteCapacityAlarmCreation() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); var logger = new Mock <IAlarmLogger>(); var tableAlarmCreator = new TableAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); var table = MakeTableDescription(); await tableAlarmCreator.EnsureWriteCapacityAlarm(table, "suffix", 0.52, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenDryRunWriteCapacityAlarmIsNotPut() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); var logger = new Mock <IAlarmLogger>(); var indexAlarmCreator = new IndexAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); var table = MakeTableDescription(); var index = MakeIndexDescription(); await indexAlarmCreator.EnsureWriteCapacityAlarm(table, index, "suffix", 0.52, "testArn", true); VerifyCloudwatch.PutMetricAlarmWasNotCalled(cloudWatch); }
public async Task TestBasicReadCapacityAlarmCreation() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); var logger = new Mock <IAlarmLogger>(); var indexAlarmCreator = new IndexAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); var table = MakeTableDescription(); var index = MakeIndexDescription(); await indexAlarmCreator.EnsureReadCapacityAlarm(table, index, "suffix", 0.52, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenReadCapacityAlarmExistsAtSameLevelNoAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 31200, 300, "testArn"); var logger = new Mock <IAlarmLogger>(); var tableAlarmCreator = new TableAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); var table = MakeTableDescription(); await tableAlarmCreator.EnsureReadCapacityAlarm(table, "suffix", 0.52, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasNotCalled(cloudWatch); }
public async Task WhenWriteCapacityAlarmExistsWithDifferentTargetAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 31200, 300, "firstTarget"); var logger = new Mock <IAlarmLogger>(); var tableAlarmCreator = new TableAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); var table = MakeTableDescription(); await tableAlarmCreator.EnsureReadCapacityAlarm(table, "suffix", 0.52, "secondTarget", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenWriteThrottlingAlarmExistsWithDifferentThresholdAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 101, 300, "testArn"); var logger = new Mock <IAlarmLogger>(); var tableAlarmCreator = new TableAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); var table = MakeTableDescription(); await tableAlarmCreator.EnsureWriteThrottleAlarm(table, "suffix", 10, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenWriteThrottlingAlarmExistsAtSameLevelNoAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 5, 60, "testArn"); var logger = new Mock <IAlarmLogger>(); var tableAlarmCreator = new TableAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); var table = MakeTableDescription(); await tableAlarmCreator.EnsureWriteThrottleAlarm(table, "suffix", 5, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasNotCalled(cloudWatch); }
public async Task WhenReadCapacityAlarmExistsWithDifferentThresholdAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 42, 300, "testArn"); var logger = new Mock <IAlarmLogger>(); var tableAlarmCreator = new TableAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object, Mock.Of <ILegacyAlarmTracker>()); var table = MakeTableDescription(); await tableAlarmCreator.EnsureReadCapacityAlarm(table, "suffix", 0.52, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }
public async Task WhenReadCapacityAlarmExistsWithDifferentPeriodAlarmIsCreated() { var cloudWatch = new Mock <IAmazonCloudWatch>(); var alarmFinder = new Mock <IAlarmFinder>(); VerifyCloudwatch.AlarmFinderFindsThreshold(alarmFinder, 31200, 123, "testArn"); var logger = new Mock <IAlarmLogger>(); var indexAlarmCreator = new IndexAlarmCreator( cloudWatch.Object, alarmFinder.Object, logger.Object); var table = MakeTableDescription(); var index = MakeIndexDescription(); await indexAlarmCreator.EnsureReadCapacityAlarm(table, index, "suffix", 0.52, "testArn", false); VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch); }