Beispiel #1
0
        public async Task WhenDryRunReadCapacityAlarmIsNotPut()
        {
            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);

            var table = MakeTableDescription();

            await tableAlarmCreator.EnsureReadCapacityAlarm(table, "suffix", 0.52, "testArn", true);

            VerifyCloudwatch.PutMetricAlarmWasNotCalled(cloudWatch);
        }
Beispiel #2
0
        public async Task TestBasicReadCapacityAlarmCreation()
        {
            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.EnsureReadCapacityAlarm(table, "suffix", 0.52, "testArn", false);

            VerifyCloudwatch.PutMetricAlarmWasCalledOnce(cloudWatch);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }