Best Python code snippet using localstack_python
ea-deployment-test.py
Source:ea-deployment-test.py
...60 print "Exception {}".format(e)61 time.sleep(5)62 time_spent += 563 return False64 def test_route53(self, host):65 @retry(wait_fixed=5000, stop_max_delay=self.timeout)66 def ping_host():67 print "About to check host {}".format(host)68 re = requests.get("http://{}".format(host))69 print "Got {} from {}".format(re.reason, host)70 re.raise_for_status()71 try:72 ping_host()73 return True74 except Exception as e:75 print "Got exception {}".format(e)76 return False77 @retry(wait_exponential_multiplier=100,78 stop_max_attempt_number=10)79 def kill_deployment(self):80 url = "http://axworkflowadc.axsys:8911/v1/adc/workflows/{}".format(self.root_id)81 re = requests.delete(url)82 print "Delete for {} is {}".format(url, re.reason)83 if re.ok or re.status_code == 404:84 return85 else:86 re.raise_for_status()87if __name__ == "__main__":88 test = DeploymentTest()89 parser = argparse.ArgumentParser()90 parser.add_argument("--use-route53", help="Test nginx with route53 for provided hostname")91 parsed_args, unknown_args = parser.parse_known_args(sys.argv)92 if parsed_args.use_route53:93 ok = test.test_route53(parsed_args.use_route53)94 elif len(unknown_args) > 1:95 ok = test.test_elb(path=unknown_args[1])96 else:97 ok = test.test_elb()98 try:99 test.kill_deployment()100 except Exception as e:101 print "Got exception when trying to delete deployment {}".format(e)102 if not ok:103 print ("Test failed in {} seconds".format(test.timeout))104 sys.exit(1)...
test_kube_service_dns_exporter.py
Source:test_kube_service_dns_exporter.py
...12@pytest.fixture(scope='function')13def route53(aws_credentials):14 with mock_route53():15 yield boto3.client('route53')16def test_route53(route53):17 assert os.getenv('domain_name') == 'test.com'18 resp = route53.create_hosted_zone(Name=os.getenv('domain_name'), CallerReference=str(hash('xxx')))19 zone_id = resp['HostedZone']['Id']20 os.environ['hosted_zone_id'] = zone_id21 dns_name, record = route53_dns('CREATE', 'test_service', '127.0.0.2')22 assert dns_name == 'kube-test_service.test.com'...
test_aws_route53.py
Source:test_aws_route53.py
...4import placebo5from boto3.session import Session6from compose_x_common.aws.route53 import list_all_hosted_zones, list_all_records7HERE = path.abspath(path.dirname(__file__))8def test_route53():9 session = Session()10 pill = placebo.attach(session, data_path=f"{HERE}/placebos/route53/")11 pill.record()12 # pill.playback()13 _zones = list_all_hosted_zones(session=session, MaxItems="1")14 assert len(_zones) == 315 _records = list_all_records(_zones[0]["Id"], session=session, MaxItems="5")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!