def setUpClass(cls): if not sys.warnoptions: import warnings warnings.simplefilter("ignore") cls.logger = ConsoleLogger() cls.resource_stack = get_resource_stack( TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.instance_id = cls.resource_stack.stack_outputs["InstanceId0"] cls.root_volume = Ec2(region()).get_root_volume(cls.instance_id) cls.data_volumes = [ cls.resource_stack.stack_outputs["VolumeId0"], cls.resource_stack.stack_outputs["VolumeId1"] ] cls.task_runner = get_task_runner(TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK) cls.ec2 = Ec2(region())
def setUpClass(cls): if not sys.warnoptions: import warnings warnings.simplefilter("ignore") cls.logger = ConsoleLogger() cls.task_runner = get_task_runner(TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK) cls.resource_stack = get_resource_stack( TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.ec2 = Ec2(region()) cls.volume_unencrypted = cls.resource_stack.stack_outputs[ "VolumeIdEncryptedUnencrypted"] cls.volume_encrypted_default = cls.resource_stack.stack_outputs[ "VolumeIdEncryptedDefault"] cls.volume_encrypted_custom = cls.resource_stack.stack_outputs[ "VolumeIdEncryptedCustom"] cls.custom_key_arn = cls.resource_stack.stack_outputs[ "EncryptionKeyArn"]
def setUpClass(cls): cls.ec2 = Ec2(region()) cls.elb = Elb(region()) cls.elbv2 = ElbV2(region()) cls.logger = ConsoleLogger() cls.resource_stack = get_resource_stack(TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.v1_elb_name = cls.resource_stack.stack_outputs["V1LoadBalancerName"] cls.v2_target_group_arn = cls.resource_stack.stack_outputs["V2TargetGroupArn"] cls.instance_profile = cls.resource_stack.stack_outputs["InstanceProfile"] # noinspection PyPep8,PyBroadException try: cls.ec2.ec2_service.get(services.ec2_service.KEY_PAIRS, KeyNames=[TESTED_ACTION], region=region()) cls.key_pair = TESTED_ACTION except: cls.key_pair = cls.ec2.ec2_client.create_key_pair(KeyName=TESTED_ACTION).get("KeyName") cls.ami_single_volume = cls.ec2.latest_aws_linux_image["ImageId"] cls.task_runner = get_task_runner(TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK)
def setUpClass(cls): if not sys.warnoptions: import warnings warnings.simplefilter("ignore") cls.logger = ConsoleLogger() cls.resource_stack = get_resource_stack( TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.instance_no_cpu_load = cls.resource_stack.stack_outputs[ "InstanceNoCPULoad"] cls.instance_cpu_load = cls.resource_stack.stack_outputs[ "InstanceCPULoad"] cls.task_runner = get_task_runner( TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK, interval="0/{} * * * ?".format(INTERVAL_MINUTES)) cls.ec2 = Ec2(region()) testing.tags.set_ec2_tag_to_delete( ec2_client=cls.ec2, resource_ids=[cls.instance_no_cpu_load, cls.instance_cpu_load]) cls.metrics_client = CloudwatchMetrics(region())
def setUpClass(cls): if not sys.warnoptions: import warnings warnings.simplefilter("ignore") cls.logger = ConsoleLogger() cls.resource_stack = get_resource_stack( TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.ec2 = Ec2(region()) cls.instance_id = cls.resource_stack.stack_outputs["InstanceId"] if KEEP_AND_USE_EXISTING_ACTION_STACK: cls.ec2.start_instance(cls.instance_id) testing.tags.set_ec2_tag_to_delete(ec2_client=cls.ec2, resource_ids=[cls.instance_id]) cls.task_runner = get_task_runner(TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK) tags = cls.ec2.get_instance_tags(cls.instance_id) cls.original_tags = { t: tags[t] for t in tags if not t.startswith("aws:") }
def setUpClass(cls): cls.logger = ConsoleLogger() cls.resource_stack = get_resource_stack(TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.volume_id = cls.resource_stack.stack_outputs["VolumeId0"] cls.ec2 = Ec2(region()) cls.task_runner = get_task_runner(TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK)
def setUpClass(cls): cls.logger = ConsoleLogger() cls.resource_stack = get_resource_stack( TESTED_ACTION, create_resource_stack_func=cls.create_resource_stack, use_existing=KEEP_AND_USE_EXISTING_RESOURCES_STACK, region_name=region()) assert (cls.resource_stack is not None) cls.dynamodb = DynamoDB(region=region()) cls.table_name = cls.resource_stack.stack_outputs["TableName"] cls.task_runner = get_task_runner(TESTED_ACTION, KEEP_AND_USE_EXISTING_ACTION_STACK) cls.logger.debug( "Waiting for continuous backups to become available for table {}", cls.table_name) assert (cls.dynamodb.wait_until_table_backups_available( cls.table_name))