Exemple #1
0
        public void Config_Fails_When_AlertingGroups_Is_Empty()
        {
            // arrange
            _config.AlertingGroups = new List <AlertingGroup>();

            // act

            // assert
            ConfigAssert.NotValid(_config, "Config must have alerting groups");
        }
        public void SqsConfig_Fails_When_Sqs_Error_LengthThreshold_Is_TooHigh()
        {
            // arrange
            _sqs.Errors.LengthThreshold = 100003;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Queue length of '100003' is ridiculously high");
        }
        public void DynamoDbConfig_Fails_When_Threshold_Is_Too_High()
        {
            // arrange
            _dynamoDb.Threshold = 1.1;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Threshold of '1.1' must be less than or equal to one");
        }
Exemple #4
0
        public void Config_Fails_When_AlertingGroups_Is_Null()
        {
            // arrange
            _config.AlertingGroups = null;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Config must have alerting groups");
        }
        public void SqsConfig_Fails_When_Queue_OldestMessageThreshold_Is_TooHigh()
        {
            // arrange
            _sqs.Queues.First().OldestMessageThreshold = SevenDays + 1;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Max age of '604801' is ridiculously high");
        }
        public void DynamoDbConfig_Fails_When_Threshold_Is_Too_Low()
        {
            // arrange
            _dynamoDb.Threshold = 0.0;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Threshold of '0' must be greater than zero");
        }
Exemple #7
0
        public void AlertingGroup_Fails_Without_Name()
        {
            // arrange
            _config.AlertingGroups.First().Name = null;

            // act

            // assert
            ConfigAssert.NotValid(_config, "AlertingGroup must have a name");
        }
        public void SqsConfig_Fails_When_Queue_LengthThreshold_Is_TooHigh()
        {
            // arrange
            _sqs.Queues.First().LengthThreshold = 100005;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Queue length of '100005' is ridiculously high");
        }
        public void SqsConfig_Fails_When_Queue_OldestMessageThreshold_Is_Negative()
        {
            // arrange
            _sqs.Queues.First().OldestMessageThreshold = -6;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Max age of '-6' must be greater than zero");
        }
        public void SqsConfig_Fails_If_Queue_Has_No_Name_Or_Pattern()
        {
            // arrange
            _sqs.Queues.First().Name = null;

            // act

            // assert
            ConfigAssert.NotValid(_config, "AlertingGroup 'someName' has a queue with no name or pattern");
        }
        public void SqsConfig_Fails_When_Sqs_Error_OldestMessageThreshold_Is_Negative()
        {
            // arrange
            _sqs.Errors.OldestMessageThreshold = -4;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Max age of '-4' must be greater than zero");
        }
        public void SqsConfig_Fails_If_Queue_Is_Null()
        {
            // arrange
            _sqs.Queues.Add(null);

            // act

            // assert
            ConfigAssert.NotValid(_config, "AlertingGroup 'someName' has a null queue");
        }
        public void SqsConfig_Fails_When_Queue_Error_LengthThreshold_Is_Negative()
        {
            // arrange
            _sqs.Queues.First().Errors.LengthThreshold = -7;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Queue length of '-7' must be greater than zero");
        }
Exemple #14
0
        public void Config_Fails_When_Null()
        {
            // arrange
            _config = null;

            // act

            // assert
            ConfigAssert.NotValid(_config, "Config cannot be null");
        }
Exemple #15
0
        public void AlertingGroup_Fails_When_Targets_Is_Null()
        {
            // arrange
            _config.AlertingGroups.First().Targets = null;

            // act

            // assert
            ConfigAssert.NotValid(_config, "AlertingGroup 'someName' must have targets");
        }
Exemple #16
0
        public void AlertingGroup_Fails_Without_AlarmNameSuffix()
        {
            // arrange
            _config.AlertingGroups.First().AlarmNameSuffix = null;

            // act

            // assert
            ConfigAssert.NotValid(_config, "AlertingGroup 'someName' must have an alarm suffix");
        }
        public void DynamoDbConfig_Fails_With_Invalid_ThrottlingThreshold()
        {
            // arrange
            _dynamoDb.ThrottlingThreshold = -42;

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has DynamoDb with an invalid throttling threshold of -42");
        }
        public void SqsConfig_Fails_If_Queue_Has_Name_And_Pattern()
        {
            // arrange
            _sqs.Queues.First().Pattern = "QueuePattern";

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a queue 'QueueName' with a name and a pattern");
        }
        public void DynamoDbConfig_Fails_When_Table_Threshold_Is_Too_Low()
        {
            // arrange
            _dynamoDb.Tables.First().Threshold = -4.2;

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "Threshold of '-4.2' must be greater than zero");
        }
        public void DynamoDbConfig_Fails_When_Table_Is_Null()
        {
            // arrange
            _dynamoDb.Tables.Add(null);

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a null table");
        }
        public void AwsServicesConfig_Fails_When_Resource_Is_Null()
        {
            // arrange
            _awsServiceAlarms.Resources.Add(null);

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a 'Lambda' Service with null resource");
        }
        public void DynamoDbConfig_Fails_When_Table_Has_Name_And_Pattern()
        {
            // arrange
            _dynamoDb.Tables.First().Pattern = "TablePattern";

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a table 'TableName' with a name and a pattern");
        }
        public void DynamoDbConfig_Fails_When_Table_Has_No_Name_Or_Pattern()
        {
            // arrange
            _dynamoDb.Tables.First().Name = null;

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a table with no name or pattern");
        }
        public void FailsIfServiceHasNoResources()
        {
            // arrange
            _awsServiceAlarms.Resources = null;

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a 'Lambda' Service with missing Resources section");
        }
        public void AwsServicesConfig_Fails_When_ResourceThreshold_Is_Negative()
        {
            // arrange
            _awsServiceAlarms.Resources.First().Values.Add("invalidThreshold", -42);

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "Threshold of 'invalidThreshold' must be greater than zero");
        }
        public void AwsServicesConfig_Fails_When_There_Is_No_Name_Or_Pattern()
        {
            // arrange
            _awsServiceAlarms.Resources.First().Name = null;

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "AlertingGroup 'someName' has a 'Lambda' Service with no name or pattern");
        }
        public void DynamoDbConfig_Fails_When_Throtting_Threshold_Is_Negative()
        {
            // arrange
            _dynamoDb.Tables.First().ThrottlingThreshold = -1;

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "Throttling threshold of '-1' must be greater than zero");
        }
Exemple #28
0
        public void AwsServicesConfig_Fails_When_ServiceThreshold_Is_TooHigh()
        {
            // arrange
            _awsServiceAlarms.Values.Add("invalidThreshold", 100500);

            // act

            // assert
            ConfigAssert.NotValid(_config,
                                  "Threshold of 'invalidThreshold' is ridiculously high");
        }
Exemple #29
0
        public void AlertingGroup_Fails_When_Name_Is_Too_Long()
        {
            // arrange
            var tooLongName = "here_should_be_more_then_100_symbols_here_should_be_more_then_100_symbols_here_should_be_more_then_100_symbols";

            _config.AlertingGroups.First().Name = tooLongName;

            // act

            // assert
            ConfigAssert.NotValid(_config, $"AlertingGroup name '{tooLongName}' must be valid in SNS topics");
        }
Exemple #30
0
        public void AlertingGroup_Fails_When_Name_Contains_Incorrect_Symbols()
        {
            // arrange
            var incorrectName = "this_symbols_are_incorrect_for_name_%^&*@";

            _config.AlertingGroups.First().Name = incorrectName;

            // act

            // assert
            ConfigAssert.NotValid(_config, $"AlertingGroup name '{incorrectName}' must be valid in SNS topics");
        }