Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_ecs(self):
# init client
client = AcsClient(
os.environ['ACCESS_KEY_ID'],
os.environ['ACCESS_KEY_SECRET'],
"cn-hangzhou"
)
mylogger.info("Init client success")
# get demo instance attributes
image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)
# create
instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# start
TestEcsIntegration.start_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')
# stop
TestEcsIntegration.stop_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
os.environ['ACCESS_KEY_SECRET'],
"cn-hangzhou"
)
mylogger.info("Init client success")
# get demo instance attributes
image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)
# create
instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# start
TestEcsIntegration.start_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')
# stop
TestEcsIntegration.stop_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# delete
TestEcsIntegration.delete_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Deleted')
image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)
# create
instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# start
TestEcsIntegration.start_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')
# stop
TestEcsIntegration.stop_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# delete
TestEcsIntegration.delete_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Deleted')
def test_ecs(self):
# init client
client = AcsClient(
os.environ['ACCESS_KEY_ID'],
os.environ['ACCESS_KEY_SECRET'],
"cn-hangzhou"
)
mylogger.info("Init client success")
# get demo instance attributes
image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)
# create
instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# start
TestEcsIntegration.start_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')
# stop
TestEcsIntegration.stop_instance(client, instance_id)
# init client
client = AcsClient(
os.environ['ACCESS_KEY_ID'],
os.environ['ACCESS_KEY_SECRET'],
"cn-hangzhou"
)
mylogger.info("Init client success")
# get demo instance attributes
image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)
# create
instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# start
TestEcsIntegration.start_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')
# stop
TestEcsIntegration.stop_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# delete
TestEcsIntegration.delete_instance(client, instance_id)
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# start
TestEcsIntegration.start_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')
# stop
TestEcsIntegration.stop_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
# delete
TestEcsIntegration.delete_instance(client, instance_id)
# wait
TestEcsIntegration.wait_for_instance(client, instance_id, 'Deleted')