issue #542: .ci: move some tests to Azure and enable Mac job.

pull/564/head
David Wilson 7 years ago
parent 458a4faa97
commit 0aa4c9d8fc

@ -0,0 +1,20 @@
parameters:
name: ''
pool: ''
sign: false
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: .ci/prep_azure.py
displayName: "Install requirements."
- script: .ci/$(MODE)_install.py
displayName: "Install requirements."
- script: .ci/$(MODE)_tests.py
displayName: Run tests.

@ -5,79 +5,85 @@
jobs: jobs:
- job: 'MitogenTests' - job: Mac
steps:
- template: azure-pipelines-steps.yml
pool: pool:
vmImage: 'Ubuntu 16.04' vmImage: macOS-10.13
strategy: strategy:
matrix: matrix:
Mitogen27Debian_27: Mito27_27:
python.version: '2.7' python.version: '2.7'
MODE: mitogen MODE: mitogen
DISTRO: debian
MitogenPy27CentOS6_26:
- job: Linux
pool:
vmImage: "Ubuntu 16.04"
steps:
- template: azure-pipelines-steps.yml
strategy:
matrix:
#
# Confirmed working
#
Mito27Debian_27:
python.version: '2.7' python.version: '2.7'
MODE: mitogen MODE: mitogen
DISTRO: centos6 DISTRO: debian
#Py26CentOS7: #MitoPy27CentOS6_26:
#python.version: '2.7' #python.version: '2.7'
#MODE: mitogen #MODE: mitogen
#DISTRO: centos6 #DISTRO: centos6
Mitogen36CentOS6_26: Mito36CentOS6_26:
python.version: '3.6' python.version: '3.6'
MODE: mitogen MODE: mitogen
DISTRO: centos6 DISTRO: centos6
DebOps_2460_27_27: #
python.version: '2.7' #
MODE: debops_common #
VER: 2.4.6.0
DebOps_262_36_27:
python.version: '3.6'
MODE: debops_common
VER: 2.6.2
Ansible_2460_26:
python.version: '2.7'
MODE: ansible
VER: 2.4.6.0
Ansible_262_26: #Py26CentOS7:
python.version: '2.7' #python.version: '2.7'
MODE: ansible #MODE: mitogen
VER: 2.6.2 #DISTRO: centos6
Ansible_2460_36: #DebOps_2460_27_27:
python.version: '3.6' #python.version: '2.7'
MODE: ansible #MODE: debops_common
VER: 2.4.6.0 #VER: 2.4.6.0
Ansible_262_36: #DebOps_262_36_27:
python.version: '3.6' #python.version: '3.6'
MODE: ansible #MODE: debops_common
VER: 2.6.2 #VER: 2.6.2
Vanilla_262_27: #Ansible_2460_26:
python.version: '2.7' #python.version: '2.7'
MODE: ansible #MODE: ansible
VER: 2.6.2 #VER: 2.4.6.0
DISTROS: debian
STRATEGY: linear
steps: #Ansible_262_26:
- task: UsePythonVersion@0 #python.version: '2.7'
inputs: #MODE: ansible
versionSpec: '$(python.version)' #VER: 2.6.2
architecture: 'x64'
- script: .ci/prep_azure.py #Ansible_2460_36:
displayName: "Install requirements." #python.version: '3.6'
#MODE: ansible
#VER: 2.4.6.0
- script: .ci/$(MODE)_install.py #Ansible_262_36:
displayName: "Install requirements." #python.version: '3.6'
#MODE: ansible
#VER: 2.6.2
- script: .ci/$(MODE)_tests.py #Vanilla_262_27:
displayName: Run tests. #python.version: '2.7'
#MODE: ansible
#VER: 2.6.2
#DISTROS: debian
#STRATEGY: linear

@ -43,6 +43,18 @@ if not hasattr(subprocess, 'check_output'):
subprocess.check_output = subprocess__check_output subprocess.check_output = subprocess__check_output
# ------------------
def have_apt():
proc = subprocess.Popen('apt --help >/dev/null 2>/dev/null', shell=True)
return proc.wait() == 0
def have_docker():
proc = subprocess.Popen('docker info >/dev/null 2>/dev/null', shell=True)
return proc.wait() == 0
# ----------------- # -----------------
# 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.

@ -6,10 +6,12 @@ batches = [
[ [
'pip install "pycparser<2.19" "idna<2.7"', 'pip install "pycparser<2.19" "idna<2.7"',
'pip install -r tests/requirements.txt', 'pip install -r tests/requirements.txt',
],
[
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
] ]
] ]
if ci_lib.have_docker():
batches.append([
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
])
ci_lib.run_batches(batches) ci_lib.run_batches(batches)

@ -11,4 +11,7 @@ os.environ.update({
'SKIP_ANSIBLE': '1', 'SKIP_ANSIBLE': '1',
}) })
if not ci_lib.have_docker():
os.environ['SKIP_DOCKER_TESTS'] = '1'
ci_lib.run('./run_tests -v') ci_lib.run('./run_tests -v')

@ -1,8 +1,13 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
import sys
import ci_lib import ci_lib
batches = [] batches = []
if ci_lib.have_apt():
batches.append([ batches.append([
'echo force-unsafe-io | sudo tee /etc/dpkg/dpkg.cfg.d/nosync', 'echo force-unsafe-io | sudo tee /etc/dpkg/dpkg.cfg.d/nosync',
'sudo add-apt-repository ppa:deadsnakes/ppa', 'sudo add-apt-repository ppa:deadsnakes/ppa',
@ -10,13 +15,16 @@ batches.append([
'sudo apt-get -y install python2.6 python2.6-dev libsasl2-dev libldap2-dev', 'sudo apt-get -y install python2.6 python2.6-dev libsasl2-dev libldap2-dev',
]) ])
batches.append([
'pip install -r dev_requirements.txt',
])
#batches.append([
#'pip install -r dev_requirements.txt',
#])
if ci_lib.have_docker():
batches.extend( batches.extend(
['docker pull %s' % (ci_lib.image_for_distro(distro),)] ['docker pull %s' % (ci_lib.image_for_distro(distro),)]
for distro in ci_lib.DISTROS for distro in ci_lib.DISTROS
) )
ci_lib.run_batches(batches) ci_lib.run_batches(batches)

@ -27,9 +27,7 @@ matrix:
# 2.4 -> 2.4 # 2.4 -> 2.4
- language: c - language: c
env: MODE=mitogen_py24 DISTRO=centos5 env: MODE=mitogen_py24 DISTRO=centos5
# 2.7 -> 2.7 # 2.7 -> 2.7 -- moved to Azure
- python: "2.7"
env: MODE=mitogen DISTRO=debian
# 2.7 -> 2.6 # 2.7 -> 2.6
#- python: "2.7" #- python: "2.7"
#env: MODE=mitogen DISTRO=centos6 #env: MODE=mitogen DISTRO=centos6
@ -39,9 +37,7 @@ matrix:
# 2.6 -> 3.5 # 2.6 -> 3.5
- python: "2.6" - python: "2.6"
env: MODE=mitogen DISTRO=debian-py3 env: MODE=mitogen DISTRO=debian-py3
# 3.6 -> 2.6 # 3.6 -> 2.6 -- moved to Azure
- python: "3.6"
env: MODE=mitogen DISTRO=centos6
# Debops tests. # Debops tests.
# 2.4.6.0; 2.7 -> 2.7 # 2.4.6.0; 2.7 -> 2.7

@ -17,6 +17,10 @@ class NullFixedPolicy(ansible_mitogen.affinity.FixedPolicy):
self.mask = mask self.mask = mask
@unittest2.skipIf(
reason='Linux only',
condition=(not os.uname()[0] == 'Linux')
)
class FixedPolicyTest(testlib.TestCase): class FixedPolicyTest(testlib.TestCase):
klass = NullFixedPolicy klass = NullFixedPolicy

@ -1,4 +1,6 @@
import sys
import unittest2 import unittest2
import mitogen.service import mitogen.service
@ -32,10 +34,15 @@ class FetchTest(testlib.RouterMixin, testlib.TestCase):
expect = service.unregistered_msg % ('/etc/shadow',) expect = service.unregistered_msg % ('/etc/shadow',)
self.assertTrue(expect in e.args[0]) self.assertTrue(expect in e.args[0])
if sys.platform == 'darwin':
ROOT_GROUP = 'wheel'
else:
ROOT_GROUP = 'root'
def _validate_response(self, resp): def _validate_response(self, resp):
self.assertTrue(isinstance(resp, dict)) self.assertTrue(isinstance(resp, dict))
self.assertEquals('root', resp['owner']) self.assertEquals('root', resp['owner'])
self.assertEquals('root', resp['group']) self.assertEquals(self.ROOT_GROUP, resp['group'])
self.assertTrue(isinstance(resp['mode'], int)) self.assertTrue(isinstance(resp['mode'], int))
self.assertTrue(isinstance(resp['mtime'], float)) self.assertTrue(isinstance(resp['mtime'], float))
self.assertTrue(isinstance(resp['atime'], float)) self.assertTrue(isinstance(resp['atime'], float))

@ -450,6 +450,8 @@ class DockerMixin(RouterMixin):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(DockerMixin, cls).setUpClass() super(DockerMixin, cls).setUpClass()
if os.environ.get('SKIP_DOCKER_TESTS'):
raise unittest2.SkipTest('SKIP_DOCKER_TESTS is set')
cls.dockerized_ssh = DockerizedSshDaemon() cls.dockerized_ssh = DockerizedSshDaemon()
cls.dockerized_ssh.wait_for_sshd() cls.dockerized_ssh.wait_for_sshd()

Loading…
Cancel
Save