public void FurtherAlarmsAreNotPut()
        {
            var mockery = new DynamoAlarmGeneratorMockery();

            TestRun(mockery);

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch, "failure-table-1");
            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch, "happy-table-2");
        }
Exemple #2
0
        public async Task AlarmsAreNotCreatedForExcludedTable()
        {
            var mockery   = new DynamoAlarmGeneratorMockery();
            var generator = mockery.AlarmGenerator;

            ConfigureTables(mockery);

            await generator.GenerateAlarmsFor(ConfigWithAnExclusion(), RunMode.GenerateAlarms);

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch, "products-table");
        }
        public void OtherAlarmsAreNotCreated()
        {
            var mockery   = new DynamoAlarmGeneratorMockery();
            var generator = mockery.AlarmGenerator;

            ConfigureTables(mockery);

            Assert.That(async() => await generator.GenerateAlarmsFor(Config(), RunMode.GenerateAlarms),
                        Throws.Exception);

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch, "my-orders");
        }
Exemple #4
0
        public void OtherAlarmsAreNotCreated()
        {
            var mockery   = new DynamoAlarmGeneratorMockery();
            var generator = mockery.AlarmGenerator;

            ConfigureTables(mockery);

            // todo, use ThrowsAsync when nunit is updated
            Assert.Throws <AggregateException>(
                () => generator.GenerateAlarmsFor(Config(), RunMode.GenerateAlarms).Wait());

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch, "my-orders");
        }
Exemple #5
0
        public async Task OnlyReadAlarmIsCreatedWhenWriteExcluded()
        {
            var mockery   = new DynamoAlarmGeneratorMockery();
            var generator = mockery.AlarmGenerator;

            ConfigureTables(mockery);

            await generator.GenerateAlarmsFor(ConfigWithExclusions(), RunMode.GenerateAlarms);

            CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch,
                                                alarmName: "test-supplier-table-ConsumedReadCapacityUnits-TestGroup",
                                                tableName: "test-supplier-table",
                                                metricName: "ConsumedReadCapacityUnits");

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch,
                                                   tableName: "test-supplier-table",
                                                   metricName: "ConsumedWriteCapacityUnits");
        }
Exemple #6
0
        public async Task AlarmsAreCreatedForEnabledTable()
        {
            var mockery   = new DynamoAlarmGeneratorMockery();
            var generator = mockery.AlarmGenerator;

            ConfigureTables(mockery);

            await generator.GenerateAlarmsFor(Config(), RunMode.GenerateAlarms);

            CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch,
                                                alarmName: "test-a-table-ConsumedReadCapacityUnits-TestGroup",
                                                tableName: "test-a-table",
                                                metricName: "ConsumedReadCapacityUnits",
                                                threshold: 292500,
                                                period: 300);

            CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch,
                                                alarmName: "test-a-table-ReadThrottleEvents-TestGroup",
                                                tableName: "test-a-table",
                                                metricName: "ReadThrottleEvents",
                                                threshold: 42,
                                                period: 60);

            CloudwatchVerify.AlarmWasPutOnTable(mockery.Cloudwatch,
                                                alarmName: "test-a-table-WriteThrottleEvents-TestGroup",
                                                tableName: "test-a-table",
                                                metricName: "WriteThrottleEvents",
                                                threshold: 42,
                                                period: 60);

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch,
                                                   tableName: "other-table",
                                                   metricName: "ReadThrottleEvents");

            CloudwatchVerify.AlarmWasNotPutOnTable(mockery.Cloudwatch,
                                                   tableName: "other-table",
                                                   metricName: "WriteThrottleEvents");

            CloudwatchVerify.AlarmWasNotPutOnMetric(mockery.Cloudwatch,
                                                    "ConsumedWriteCapacityUnits");
        }