How to use compose_config method in yandex-tank

Best Python code snippet using yandex-tank

fungiculture-builder.py

Source: fungiculture-builder.py Github

copy

Full Screen

...51 pass52 else:53 pass54 return self.cluster_compute_nodes55 def generate_compose_config(self):56 """57 method: construct dict data structure to layout Docker Compose configuration58 """59 self.compose_config = {}60 self.compose_config['version'] = self.version61 self.compose_config['networks'] = {}62 self.compose_config['networks'][self.network_name] = {'driver': 'bridge'}63 # set up nodes64 self.compose_config['services'] = {}65 # head node66 self.compose_config['services'][self.cluster_head_node] = {}67 self.compose_config['services'][self.cluster_head_node]['image'] = self.image68 self.compose_config['services'][self.cluster_head_node]['networks'] = [self.network_name]69 # compute nodes70 for node in self.cluster_compute_nodes:71 self.compose_config['services'][node] = {}72 self.compose_config['services'][node]['image'] = self.image73 self.compose_config['services'][node]['networks'] = [self.network_name]74 return self.compose_config75if __name__ == '__main__':76 # set up command arguments77 parser = argparse.ArgumentParser(description='Mushroom HPC Cluster Docker Compose Configuration Generator')78 parser.add_argument('--version', type=str, required=False, default='3.8', help='Docker Compose template version (default: 3.8)')79 parser.add_argument('--image', type=str, required=True, help='Docker image name')80 parser.add_argument('--network-name', type=str, required=True, help='Docker network name(bridge mode)')81 parser.add_argument('--head-node', type=str, required=True, help='Docker Mushroom HPC head node name')82 parser.add_argument('--compute-nodes', type=str, required=True, help='Docker Mushroom HPC compute node names (example: spore1,spore2,spore3)')83 args = parser.parse_args()84 # initialize config object85 mushroom_dc_config = ComposeBuilder()86 mushroom_dc_config.set_version(args.version)87 mushroom_dc_config.set_image(args.image)88 mushroom_dc_config.set_network_name(args.network_name)89 mushroom_dc_config.set_cluster_head_node(args.head_node)90 mushroom_dc_config.set_cluster_compute_nodes(set(args.compute_nodes.split(',')))91 # generate Docker Compose configuration92 mushroom_dc_config.generate_compose_config()93 # print Docker Compose configuration...

Full Screen

Full Screen

test_helper.py

Source: test_helper.py Github

copy

Full Screen

1import requests2import logging3import sys4import os5import pytest6import shlex7import subprocess8from retry import retry9from singledispatch import singledispatch10from subprocess import call11logging.basicConfig(stream=sys.stderr )12logging.getLogger("log").setLevel( logging.DEBUG )13log=logging.getLogger("log")14# ASSERTION HELPER METHODS15@singledispatch16def assert_status(req, status_code=200):17 log.error('input type unmatched')18 assert False # since input type unmatched19@assert_status.register(str)20def _(url, status_code=200):21 req = requests.get(url)22 assert req.status_code == status_code, req.text23 return req24@assert_status.register(requests.Response)25def _(req, status_code=200):26 assert req.status_code == status_code, req.text27 return req28# FIXTURE HELPERS FOR USING COMPOSE29def docker_compose(compose_config, command):30 compose = 'docker-compose -f ' + os.environ['CONFIGURATIONS'] + '/​' + compose_config + '.yml'31 log.debug("RUN: " + compose + ' ' + command)32 subprocess.check_output(shlex.split(compose + ' ' + command))33@retry(tries=30, delay=3)34def wait_for_web_service(url):35 log.debug("Trying to reach " + url + " ...")36 req = requests.get(url)37 if req.status_code != 200:38 raise Exception('status=' + str(req.status_code))39 return req40@pytest.fixture(scope="class")41def stack(request):42 compose_config = getattr(request.module, "compose_config", "unknown")43 wait_urls = getattr(request.module, "wait_urls", "http:/​/​unknown:123")44 log.debug('compose_config: ' + compose_config)45 docker_compose(compose_config, 'kill')46 docker_compose(compose_config, 'rm -f -v')47 docker_compose(compose_config, 'up -d')48 for url in wait_urls:49 wait_for_web_service(url)50 yield51 docker_compose(compose_config, 'kill')...

Full Screen

Full Screen

transform_circle.py

Source: transform_circle.py Github

copy

Full Screen

1import argparse2import yaml3def convert(compose_config, container_name):4 for service in compose_config.get('services', {}).values():5 if 'volumes' in service:6 service['volumes_from'] = [f'container:{container_name}']7 del service['volumes']8parser = argparse.ArgumentParser(9 description="Transform docker-compose yaml to CircleCI-compatible files")10parser.add_argument('compose_yaml', type=argparse.FileType('rb'))11parser.add_argument('container_name')12if __name__ == '__main__':13 args = parser.parse_args()14 compose_config = yaml.safe_load(args.compose_yaml)15 convert(compose_config, args.container_name)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Webinar: Move Forward With An Effective Test Automation Strategy [Voices of Community]

The key to successful test automation is to focus on tasks that maximize the return on investment (ROI), ensuring that you are automating the right tests and automating them in the right way. This is where test automation strategies come into play.

Dec’22 Updates: The All-New LT Browser 2.0, XCUI App Automation with HyperExecute, And More!

Greetings folks! With the new year finally upon us, we’re excited to announce a collection of brand-new product updates. At LambdaTest, we strive to provide you with a comprehensive test orchestration and execution platform to ensure the ultimate web and mobile experience.

Developers and Bugs – why are they happening again and again?

Entering the world of testers, one question started to formulate in my mind: “what is the reason that bugs happen?”.

Test Optimization for Continuous Integration

“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful