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 <dmitrii.shcherbakov@canonical.com>
This commit is contained in:
Chris MacNaughton 2021-01-13 11:07:16 +01:00 committed by Dmitrii Shcherbakov
parent cbe8209969
commit 902bd7c6c6
5 changed files with 46 additions and 24 deletions

View File

@ -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

26
osci.yaml Normal file
View File

@ -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

View File

@ -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

View File

@ -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

15
tox.ini
View File

@ -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/