From 902bd7c6c660468e313e7b675afc8898c9e51b6f Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Wed, 13 Jan 2021 11:07:16 +0100 Subject: [PATCH] Migrate functional testing to third-parth CI * enable running lint with the upstream linters job; * Use numeric versions of OpenStack packages in the python-packages section of the openstack-projects part since the resolver change in recent versions of pip disallows for constraints dependencies of packages that come from a URL or a path. https://github.com/pypa/pip/issues/8210 * The newest released version of pip is always used during builds since snapcraft uses venv to set up virtual environments and the ensurepip package is invoked such that a pip version shipped with the distro version of python is upgraded: https://github.com/python/cpython/blob/3.8/Lib/venv/__init__.py#L282-L289 cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade', '--default-pip'] * Environment variables are ignored when pip is installed in the venv: https://docs.python.org/3/using/cmdline.html#id2 (-I option) So there is no way to use the old pip version resolver. Change-Id: Id97dc7f14301ed0f6aed3e10f5c00e6dd7ac93d2 Co-Authored-By: Dmitrii Shcherbakov --- .zuul.yaml | 12 ++---------- osci.yaml | 26 ++++++++++++++++++++++++++ snapcraft.yaml | 12 ++++++------ tools/lxd_build.sh | 5 ++++- tox.ini | 15 ++++++++------- 5 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 osci.yaml diff --git a/.zuul.yaml b/.zuul.yaml index e79b21a..dfcb7f1 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,15 +1,7 @@ -- job: - name: microstack-tox-snap-with-sudo - parent: openstack-tox-snap-with-sudo - timeout: 7200 - nodeset: ubuntu-bionic - vars: - tox_envlist: snap - - project: check: jobs: - - microstack-tox-snap-with-sudo + - openstack-tox-linters gate: jobs: - - microstack-tox-snap-with-sudo + - openstack-tox-linters diff --git a/osci.yaml b/osci.yaml new file mode 100644 index 0000000..970fc02 --- /dev/null +++ b/osci.yaml @@ -0,0 +1,26 @@ +- job: + name: microstack-bionic + parent: openstack-tox-snap-with-sudo + timeout: 7200 + nodeset: + nodes: + - name: bionic-brown + label: bionic-brown + vars: + tox_envlist: snap +- job: + name: microstack-focal + parent: openstack-tox-snap-with-sudo + timeout: 7200 + nodeset: + nodes: + - name: focal-brown + label: focal-brown + vars: + tox_envlist: snap + +- project: + check: + jobs: + - microstack-bionic + - microstack-focal diff --git a/snapcraft.yaml b/snapcraft.yaml index 1dc757e..aff40c5 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -702,12 +702,12 @@ parts: - pymysql - uwsgi - git+https://opendev.org/x/snap.openstack#egg=snap.openstack - - http://tarballs.openstack.org/nova/nova-stable-ussuri.tar.gz - - https://tarballs.opendev.org/openstack/neutron/neutron-stable-ussuri.tar.gz - - https://tarballs.opendev.org/openstack/glance/glance-stable-ussuri.tar.gz - - https://tarballs.opendev.org/openstack/cinder/cinder-stable-ussuri.tar.gz - - https://tarballs.opendev.org/openstack/placement/placement-stable-ussuri.tar.gz - - https://tarballs.opendev.org/openstack/horizon/horizon-stable-ussuri.tar.gz + - nova==21.1.1 + - neutron===16.2.0 + - glance==20.0.1 + - cinder==16.2.1 + - openstack-placement==3.0.0 + - horizon==18.3.2 - python-cinderclient - python-openstackclient - python-swiftclient diff --git a/tools/lxd_build.sh b/tools/lxd_build.sh index af64f60..592d875 100755 --- a/tools/lxd_build.sh +++ b/tools/lxd_build.sh @@ -3,6 +3,7 @@ set -ex export PATH=/snap/bin:$PATH +export http_proxy HTTP_PROXY https_proxy HTTPS_PROXY sudo apt update # install Firefox which will be used for Web UI testing in a headless mode. @@ -15,6 +16,8 @@ sudo apt install -y snapd sudo snap install snapd sudo snap install --classic snapcraft +# Purge the LXD apt package in case it is still there. +sudo apt purge -y lxd lxd-client sudo snap install lxd sudo usermod -a -G lxd ${USER} @@ -23,7 +26,7 @@ sudo usermod -a -G lxd ${USER} newgrp lxd << END set -ex lxd init --auto -snapcraft --use-lxd +snapcraft --use-lxd --http-proxy=$HTTP_PROXY --https-proxy=$HTTPS_PROXY # Delete the build container to free the storage space on a test node. lxc delete snapcraft-microstack END diff --git a/tox.ini b/tox.ini index 79c37fc..8b15d6f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = lint, unit, multipass +envlist = linters, unit, multipass skipsdist = True [testenv] @@ -8,14 +8,15 @@ install_command = pip install {opts} {packages} deps = -r{toxinidir}/test-requirements.txt setenv = PATH = /snap/bin:{env:PATH} -passenv = HOME TERM DISTRO INTERACTIVE_DEBUG USER SNAP_FILE +passenv = HOME TERM DISTRO INTERACTIVE_DEBUG USER SNAP_FILE http_proxy https_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY whitelist_externals = sudo /snap/bin/snapcraft + bash commands = {toxinidir}/tools/basic_setup.sh flake8 {toxinidir}/tests/ - {toxinidir}/tests/test_basic.py + bash -c "unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY ; {toxinidir}/tests/test_basic.py" [testenv:snap] # Testing environment for the gerrit gate. Named 'snap' to conform to @@ -26,7 +27,7 @@ commands = flake8 {toxinidir}/tests/ # Specify tests in sequence, as they can't run in parallel if not # using multipass. - {toxinidir}/tests/test_basic.py + bash -c "unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY ; {toxinidir}/tests/test_basic.py" [testenv:multipass] # Default testing environment for a human operated machine. Builds the @@ -42,7 +43,7 @@ setenv = commands = {toxinidir}/tools/multipass_build.sh flake8 {toxinidir}/tests/ - {toxinidir}/tests/test_basic.py + bash -c "unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY ; {toxinidir}/tests/test_basic.py" [testenv:basic] # Run basic tests, with default distro. @@ -86,7 +87,7 @@ setenv = commands = {toxinidir}/tools/basic_setup.sh flake8 {toxinidir}/tests/ - {toxinidir}/tests/test_cluster.py + bash -c "unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY ; {toxinidir}/tests/test_cluster.py" [testenv:build] # Just build the snap, using multipass. @@ -96,7 +97,7 @@ setenv = commands = {toxinidir}/tools/multipass_build.sh -[testenv:lint] +[testenv:linters] commands = flake8 {toxinidir}/tests/ flake8 {toxinidir}/tools/