tests: basic (incomplete) Azure Pipelines config

issue510
David Wilson 6 years ago
parent 3f414d5967
commit 0b86c4e45f

@ -41,6 +41,7 @@ with ci_lib.Fold('job_setup'):
run("mkdir %s", HOSTS_DIR) run("mkdir %s", HOSTS_DIR)
run("ln -s %s/hosts/common-hosts %s", TESTS_DIR, HOSTS_DIR) run("ln -s %s/hosts/common-hosts %s", TESTS_DIR, HOSTS_DIR)
docker_hostname = ci_lib.get_docker_hostname()
with open(os.path.join(HOSTS_DIR, 'target'), 'w') as fp: with open(os.path.join(HOSTS_DIR, 'target'), 'w') as fp:
fp.write('[test-targets]\n') fp.write('[test-targets]\n')
for i, distro in enumerate(ci_lib.DISTROS): for i, distro in enumerate(ci_lib.DISTROS):
@ -51,7 +52,7 @@ with ci_lib.Fold('job_setup'):
"ansible_password=has_sudo_nopw_password" "ansible_password=has_sudo_nopw_password"
"\n" % ( "\n" % (
distro, distro,
ci_lib.DOCKER_HOSTNAME, docker_hostname,
BASE_PORT + i, BASE_PORT + i,
)) ))

@ -5,51 +5,82 @@
jobs: jobs:
- job: 'Test' - job: 'MitogenTests'
pool: pool:
vmImage: 'Ubuntu 16.04' vmImage: 'Ubuntu 16.04'
strategy: strategy:
matrix: matrix:
Python27: Mitogen27Debian_27:
python.version: '2.7' python.version: '2.7'
Python35: MODE: mitogen
python.version: '3.5' DISTRO: debian
Python36:
MitogenPy27CentOS6_26:
python.version: '2.7'
MODE: mitogen
DISTRO: centos6
#Py26CentOS7:
#python.version: '2.7'
#MODE: mitogen
#DISTRO: centos6
Mitogen36CentOS6_26:
python.version: '3.6' python.version: '3.6'
Python37: MODE: mitogen
python.version: '3.7' DISTRO: centos6
maxParallel: 4
steps: DebOps_2460_27_27:
- task: UsePythonVersion@0 python.version: '2.7'
inputs: MODE: debops_common
versionSpec: '$(python.version)' VER: 2.4.6.0
architecture: 'x64'
- script: python -m pip install --upgrade pip && pip install -r requirements.txt DebOps_262_36_27:
displayName: 'Install dependencies' python.version: '3.6'
MODE: debops_common
VER: 2.6.2
- script: | Ansible_2460_26:
pip install pytest python.version: '2.7'
pytest tests --doctest-modules --junitxml=junit/test-results.xml MODE: ansible
displayName: 'pytest' VER: 2.4.6.0
- task: PublishTestResults@2 Ansible_262_26:
inputs: python.version: '2.7'
testResultsFiles: '**/test-results.xml' MODE: ansible
testRunTitle: 'Python $(python.version)' VER: 2.6.2
condition: succeededOrFailed()
- job: 'Publish' Ansible_2460_36:
dependsOn: 'Test' python.version: '3.6'
pool: MODE: ansible
vmImage: 'Ubuntu 16.04' VER: 2.4.6.0
Ansible_262_36:
python.version: '3.6'
MODE: ansible
VER: 2.6.2
Vanilla_262_27:
python.version: '2.7'
MODE: ansible
VER: 2.6.2
DISTROS: debian
STRATEGY: linear
steps: steps:
- task: UsePythonVersion@0 - task: UsePythonVersion@0
inputs: inputs:
versionSpec: '3.x' versionSpec: '$(python.version)'
architecture: 'x64' architecture: 'x64'
- script: python setup.py sdist - script: .ci/prep_azure.py
displayName: 'Build sdist' displayName: "Install requirements."
- script: |
export TRAVIS_BUILD_DIR=`pwd`
if [ -f ".ci/$(MODE)_tests.sh" ]; then
.ci/$(MODE)_tests.sh;
else
.ci/$(MODE)_tests.py;
fi
displayName: Run tests.

@ -10,8 +10,6 @@ import shlex
import shutil import shutil
import tempfile import tempfile
import os
os.system('curl -H Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/machine-type')
# #
# check_output() monkeypatch cutpasted from testlib.py # check_output() monkeypatch cutpasted from testlib.py
@ -37,20 +35,21 @@ if not hasattr(subprocess, 'check_output'):
# Force stdout FD 1 to be a pipe, so tools like pip don't spam progress bars. # Force stdout FD 1 to be a pipe, so tools like pip don't spam progress bars.
proc = subprocess.Popen( if sys.platform.startswith('linux'):
proc = subprocess.Popen(
args=['stdbuf', '-oL', 'cat'], args=['stdbuf', '-oL', 'cat'],
stdin=subprocess.PIPE stdin=subprocess.PIPE
) )
os.dup2(proc.stdin.fileno(), 1) os.dup2(proc.stdin.fileno(), 1)
os.dup2(proc.stdin.fileno(), 2) os.dup2(proc.stdin.fileno(), 2)
def cleanup_travis_junk(stdout=sys.stdout, stderr=sys.stderr, proc=proc): def cleanup_travis_junk(stdout=sys.stdout, stderr=sys.stderr, proc=proc):
stdout.close() stdout.close()
stderr.close() stderr.close()
proc.terminate() proc.terminate()
atexit.register(cleanup_travis_junk) atexit.register(cleanup_travis_junk)
# ----------------- # -----------------
@ -113,10 +112,11 @@ os.environ['PYTHONPATH'] = '%s:%s' % (
GIT_ROOT GIT_ROOT
) )
DOCKER_HOSTNAME = subprocess.check_output([ def get_docker_hostname():
return subprocess.check_output([
sys.executable, sys.executable,
os.path.join(GIT_ROOT, 'tests/show_docker_hostname.py'), os.path.join(GIT_ROOT, 'tests/show_docker_hostname.py'),
]).decode().strip() ]).decode().strip()
# SSH passes these through to the container when run interactively, causing # SSH passes these through to the container when run interactively, causing
# stdout to get messed up with libc warnings. # stdout to get messed up with libc warnings.

@ -2,4 +2,4 @@
# Run the Mitogen tests. # Run the Mitogen tests.
MITOGEN_TEST_DISTRO="${DISTRO:-debian}" MITOGEN_TEST_DISTRO="${DISTRO:-debian}"
MITOGEN_LOG_LEVEL=debug PYTHONPATH=. ${TRAVIS_BUILD_DIR}/run_tests -vvv MITOGEN_LOG_LEVEL=debug PYTHONPATH=. ${TRAVIS_BUILD_DIR}/run_tests -v

@ -0,0 +1,36 @@
#!/usr/bin/env python
# Run preparation steps in parallel.
import subprocess
import ci_lib
subprocess.check_call(
'echo force-unsafe-io | sudo tee /etc/dpkg/dpkg.cfg.d/nosync',
shell=True,
)
procs = [
subprocess.Popen(
'pip install -r dev_requirements.txt 2>&1 | cat',
shell=True,
),
subprocess.Popen(
"""
sudo add-apt-repository ppa:deadsnakes/ppa && \
( sudo apt-get update 2>&1 | cat ) && \
sudo apt-get -y install \
python2.6 python2.6-dev libsasl2-dev libldap2-dev 2>&1 | cat
""",
shell=True,
)
]
procs += [
subprocess.Popen(
'docker pull mitogen/%s-test 2>&1 | cat' % (distro,),
shell=True
)
for distro in ci_lib.DISTROS
]
assert [proc.wait() for proc in procs] == [0] * len(procs)
Loading…
Cancel
Save