#!/usr/bin/env python # Run the Mitogen tests. import os import ci_lib os.environ.update({ 'MITOGEN_TEST_DISTRO': ci_lib.DISTRO, 'MITOGEN_LOG_LEVEL': 'debug', 'SKIP_ANSIBLE': '1', }) if not ci_lib.have_docker(): os.environ['SKIP_DOCKER_TESTS'] = '1' ci_lib.run('./run_tests -v')
import shutil import sys import ci_lib from ci_lib import run TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') IMAGE_PREP_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/image_prep') HOSTS_DIR = os.path.join(TESTS_DIR, 'hosts') KEY_PATH = os.path.join(TESTS_DIR, '../data/docker/mitogen__has_sudo_pubkey.key') with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') with ci_lib.Fold('job_setup'): # Don't set -U as that will upgrade Paramiko to a non-2.6 compatible version. run("pip install -q virtualenv ansible==%s", ci_lib.ANSIBLE_VERSION) os.chmod(KEY_PATH, int('0600', 8)) if not ci_lib.exists_in_path('sshpass'): run("brew install http://git.io/sshpass.rb") with ci_lib.Fold('machine_prep'): ssh_dir = os.path.expanduser('~/.ssh') if not os.path.exists(ssh_dir): os.makedirs(ssh_dir, int('0700', 8))
import ci_lib from ci_lib import run TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') HOSTS_DIR = os.path.join(ci_lib.TMP, 'hosts') def pause_if_interactive(): if os.path.exists('/tmp/interactive'): while True: signal.pause() with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers() ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): # Don't set -U as that will upgrade Paramiko to a non-2.6 compatible version. run("pip install -q ansible==%s", ci_lib.ANSIBLE_VERSION) os.chdir(TESTS_DIR) os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7)) run("mkdir %s", HOSTS_DIR) for path in glob.glob(TESTS_DIR + '/hosts/*'): if not path.endswith('default.hosts'):
import os import sys import ci_lib from ci_lib import run TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') IMAGE_PREP_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/image_prep') HOSTS_DIR = os.path.join(TESTS_DIR, 'hosts') KEY_PATH = os.path.join(TESTS_DIR, '../data/docker/mitogen__has_sudo_pubkey.key') with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') with ci_lib.Fold('job_setup'): os.chmod(KEY_PATH, int('0600', 8)) # NOTE: sshpass v1.06 causes errors so pegging to 1.05 -> "msg": "Error when changing password","out": "passwd: DS error: eDSAuthFailed\n", # there's a checksum error with "brew install http://git.io/sshpass.rb" though, so installing manually if not ci_lib.exists_in_path('sshpass'): os.system( "curl -O -L https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz && \ tar xvf sshpass-1.05.tar.gz && \ cd sshpass-1.05 && \ ./configure && \ sudo make install") with ci_lib.Fold('machine_prep'): # generate a new ssh key for localhost ssh
TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') HOSTS_DIR = os.path.join(ci_lib.TMP, 'hosts') def pause_if_interactive(): if os.path.exists('/tmp/interactive'): while True: signal.pause() interesting = ci_lib.get_interesting_procs() with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') ci_lib.check_stray_processes(interesting) with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers() ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): os.chdir(TESTS_DIR) os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7)) run("mkdir %s", HOSTS_DIR)
import os import sys import ci_lib from ci_lib import run BASE_PORT = 2201 TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') HOSTS_DIR = os.path.join(ci_lib.TMP, 'hosts') with ci_lib.Fold('docker_setup'): for i, distro in enumerate(ci_lib.DISTROS): try: run("docker rm -f target-%s", distro) except: pass run(""" docker run --rm --detach --publish 0.0.0.0:%s:22/tcp --name=target-%s mitogen/%s-test """, BASE_PORT + i, distro, distro,) with ci_lib.Fold('job_setup'): os.chdir(TESTS_DIR) os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7))
import ci_lib # DebOps only supports Debian. ci_lib.DISTROS = ['debian'] * ci_lib.TARGET_COUNT project_dir = os.path.join(ci_lib.TMP, 'project') vars_path = 'ansible/inventory/group_vars/debops_all_hosts.yml' inventory_path = 'ansible/inventory/hosts' docker_hostname = ci_lib.get_docker_hostname() with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers(port_offset=500, name_prefix='debops-') ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): ci_lib.run('debops-init %s', project_dir) os.chdir(project_dir) ansible_strategy_plugin = "{}/ansible_mitogen/plugins/strategy".format( ci_lib.GIT_ROOT) with open('.debops.cfg', 'w') as fp: fp.write("[ansible defaults]\n" "strategy_plugins = {}\n" "strategy = mitogen_linear\n".format(ansible_strategy_plugin)) with open(vars_path, 'w') as fp: fp.write("ansible_python_interpreter: /usr/bin/python2.7\n" "\n" "ansible_user: mitogen__has_sudo_pubkey\n" "ansible_become_pass: has_sudo_pubkey_password\n"
TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') HOSTS_DIR = os.path.join(ci_lib.TMP, 'hosts') def pause_if_interactive(): if os.path.exists('/tmp/interactive'): while True: signal.pause() interesting = ci_lib.get_interesting_procs() with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') ci_lib.check_stray_processes(interesting) with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers() ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): # Don't set -U as that will upgrade Paramiko to a non-2.6 compatible version. run("pip install -q ansible==%s", ci_lib.ANSIBLE_VERSION) os.chdir(TESTS_DIR)
#!/usr/bin/env python import ci_lib # Naturally DebOps only supports Debian. ci_lib.DISTROS = ['debian'] ci_lib.run_batches([ [ 'pip install -qqq "debops[ansible]==2.1.2"', ], [ 'aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws', ], ]) ci_lib.run('ansible-galaxy collection install debops.debops:==2.1.2')
import ci_lib # DebOps only supports Debian. ci_lib.DISTROS = ['debian'] * ci_lib.TARGET_COUNT project_dir = os.path.join(ci_lib.TMP, 'project') vars_path = 'ansible/inventory/group_vars/debops_all_hosts.yml' inventory_path = 'ansible/inventory/hosts' docker_hostname = ci_lib.get_docker_hostname() with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers(port_offset=500, name_prefix='debops-') ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): ci_lib.run('debops-init %s', project_dir) os.chdir(project_dir) with open('.debops.cfg', 'w') as fp: fp.write("[ansible defaults]\n" "strategy_plugins = %s/ansible_mitogen/plugins/strategy\n" "strategy = mitogen_linear\n" % (ci_lib.GIT_ROOT, )) with open(vars_path, 'w') as fp: fp.write("ansible_python_interpreter: /usr/bin/python2.7\n" "\n" "ansible_user: mitogen__has_sudo_pubkey\n" "ansible_become_pass: has_sudo_pubkey_password\n" "ansible_ssh_private_key_file: %s\n" "\n" # Speed up slow DH generation.
#!/usr/bin/env python # Run tests/ansible/all.yml under Ansible and Ansible-Mitogen import os import sys import ci_lib from ci_lib import run TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') HOSTS_DIR = os.path.join(ci_lib.TMP, 'hosts') with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers() ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): # Don't set -U as that will upgrade Paramiko to a non-2.6 compatible version. run("pip install -q ansible==%s", ci_lib.ANSIBLE_VERSION) os.chdir(TESTS_DIR) os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7)) run("mkdir %s", HOSTS_DIR) run("ln -s %s/hosts/common-hosts %s", TESTS_DIR, HOSTS_DIR) inventory_path = os.path.join(HOSTS_DIR, 'target')