Beispiel #1
0
 def setUp(self):
     config = Config({
         "namespace":
         "namespace",
         "stacks": [
             {
                 "name": "vpc"
             },
             {
                 "name": "bastion",
                 "requires": ["vpc"]
             },
             {
                 "name": "instance",
                 "requires": ["vpc", "bastion"]
             },
             {
                 "name": "db",
                 "requires": ["instance", "vpc", "bastion"]
             },
             {
                 "name": "other",
                 "requires": ["db"]
             },
         ],
     })
     self.context = Context(config=config)
     self.action = destroy.Action(self.context, provider=mock.MagicMock())
Beispiel #2
0
 def setUp(self):
     self.context = Context({'namespace': 'namespace'})
     self.context.config = {
         'stacks': [
             {
                 'name': 'vpc'
             },
             {
                 'name': 'bastion',
                 'requires': ['vpc']
             },
             {
                 'name': 'instance',
                 'requires': ['vpc', 'bastion']
             },
             {
                 'name': 'db',
                 'requires': ['instance', 'vpc', 'bastion']
             },
             {
                 'name': 'other',
                 'requires': ['db']
             },
         ],
     }
     self.action = destroy.Action(self.context, provider=mock.MagicMock())
Beispiel #3
0
 def setUp(self):
     config = Config({
         "namespace":
         "namespace",
         "stacks": [
             {
                 "name": "vpc"
             },
             {
                 "name": "bastion",
                 "requires": ["vpc"]
             },
             {
                 "name": "instance",
                 "requires": ["vpc", "bastion"]
             },
             {
                 "name": "db",
                 "requires": ["instance", "vpc", "bastion"]
             },
             {
                 "name": "other",
                 "requires": ["db"]
             },
         ],
     })
     self.context = Context(config=config)
     self.action = destroy.Action(self.context, cancel=MockThreadingEvent())
Beispiel #4
0
        StackName="ebs-pin-test",
        LogicalResourceId="AutoScalingGroup"
    )['StackResources'][0]['PhysicalResourceId']
    logging.info("asg_name: {}".format(asg_name))

    autoscaling = boto3.client('autoscaling')
    count = return_count_after_update(asg_name, subnet_ids[0], autoscaling=autoscaling, ec2=ec2)
    assert count >= 1
    previous_count = count

    context = construct_context(subnet_ids[1])
    action = build.Action(context, provider_builder=provider_builder)
    action.run(tail=True)

    count = return_count_after_update(asg_name, subnet_ids[1], autoscaling=autoscaling, ec2=ec2)
    assert count >= previous_count + 1
    previous_count = count

    context = construct_context(subnet_ids[2])
    action = build.Action(context, provider_builder=provider_builder)
    action.run(tail=True)

    count = return_count_after_update(asg_name, subnet_ids[2], autoscaling=autoscaling, ec2=ec2)
    assert count >= previous_count + 1

    logging.info("Done!")
finally:
    if context:
        action = destroy.Action(context, provider_builder=provider_builder)
        action.run(tail=True, force=True)