diff options
| author | Zuul <zuul@review.opendev.org> | 2020-04-04 16:31:27 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2020-04-04 16:31:27 +0000 |
| commit | baec0b913af06239f0b83efc6ee71ceccba802a7 (patch) | |
| tree | 82debb1d1be0d0bf95f367c4b43a3ef9516a8c2d /tests | |
| parent | 4905a1ca6cf54993c3c0c80c0e7a808752294a58 (diff) | |
| parent | c089eab392de39ff01f9eba65ef4855a14e2076a (diff) | |
| download | kolla-baec0b913af06239f0b83efc6ee71ceccba802a7.tar.gz kolla-baec0b913af06239f0b83efc6ee71ceccba802a7.zip | |
Merge "CI: Avoid tox"
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/playbooks/pre.yml | 17 | ||||
| -rw-r--r-- | tests/playbooks/run.yml | 6 | ||||
| -rw-r--r-- | tests/templates/kolla-build.conf.j2 | 5 | ||||
| -rw-r--r-- | tests/test_build.py | 133 |
4 files changed, 21 insertions, 140 deletions
diff --git a/tests/playbooks/pre.yml b/tests/playbooks/pre.yml index d82198382..a884f810b 100644 --- a/tests/playbooks/pre.yml +++ b/tests/playbooks/pre.yml @@ -18,7 +18,18 @@ path: "{{ kolla_build_logs_dir }}" state: directory - - name: Ensure tox is installed - pip: - name: tox + - name: Install Python3 setuptools and family + package: + name: + - python3-pip + - python3-setuptools + - python3-virtualenv + - python3-wheel become: true + + - name: Install kolla + pip: + name: . + chdir: "{{ zuul.project.src_dir }}" + virtualenv: "{{ virtualenv_path }}" + virtualenv_python: python3 diff --git a/tests/playbooks/run.yml b/tests/playbooks/run.yml index cd2f5ca8c..b8031626d 100644 --- a/tests/playbooks/run.yml +++ b/tests/playbooks/run.yml @@ -32,7 +32,5 @@ src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/template_overrides.j2" dest: /etc/kolla/template_overrides.j2 - - name: Run tox - command: tox -e {{ action }}-{{ base_distro }}-{{ install_type }} - args: - chdir: "{{ zuul.project.src_dir }}" + - name: Run kolla-build + command: "{{ virtualenv_path }}/bin/kolla-build" diff --git a/tests/templates/kolla-build.conf.j2 b/tests/templates/kolla-build.conf.j2 index d707f5f87..cb1c18499 100644 --- a/tests/templates/kolla-build.conf.j2 +++ b/tests/templates/kolla-build.conf.j2 @@ -5,6 +5,11 @@ namespace = kolla {% set tag_suffix = '-aarch64' if ansible_architecture == 'aarch64' else '' %} tag = {{ (zuul.tag if zuul.pipeline == "release" else zuul.branch | basename) ~ tag_suffix }} {% endif %} +base = {{ base_distro }} +{% if base_tag is defined %} +base_tag = {{ base_tag }} +{% endif %} +install_type = {{ install_type }} push = false logs_dir = {{ kolla_build_logs_dir }} template_override = /etc/kolla/template_overrides.j2 diff --git a/tests/test_build.py b/tests/test_build.py deleted file mode 100644 index c4a4a6aed..000000000 --- a/tests/test_build.py +++ /dev/null @@ -1,133 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import multiprocessing -import os -import sys -from unittest.mock import patch - -from oslo_log import fixture as log_fixture -from oslo_log import log as logging -from oslotest import base -import testtools - - -sys.path.append( - os.path.abspath(os.path.join(os.path.dirname(__file__), '../tools'))) -from kolla.image import build # noqa - -LOG = logging.getLogger(__name__) - - -class BuildTest(object): - excluded_images = [] - - def setUp(self): - super(BuildTest, self).setUp() - self.useFixture(log_fixture.SetLogLevel([__name__], - logging.logging.INFO)) - - self.threads = multiprocessing.cpu_count() - if self.threads < 4: - self.threads = 4 - - self.build_args = [__name__, '--threads', str(self.threads)] - - @testtools.skipUnless(os.environ.get('DOCKER_BUILD_TEST'), - 'Skip the docker build test') - def runTest(self): - with patch.object(sys, 'argv', self.build_args): - LOG.info("Running with args %s", self.build_args) - (bad_results, good_results, unmatched_results, - skipped_results, unbuildable_results) = build.run_build() - - failures = 0 - for image, result in bad_results.items(): - if result != 'error': - continue - failures = failures + 1 - LOG.critical(">>> Expected image '%s' to succeed!", image) - - for image in unmatched_results: - LOG.warning(">>> Image '%s' was not matched", image) - - self.assertEqual(0, failures, "%d failure(s) occurred" % failures) - - -class BuildTestCentosBinary(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestCentosBinary, self).setUp() - self.build_args.extend(["--base", "centos", - "--type", "binary"]) - - -class BuildTestCentosSource(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestCentosSource, self).setUp() - self.build_args.extend(["--base", "centos", - "--type", "source"]) - - -class BuildTestCentos8Binary(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestCentos8Binary, self).setUp() - # TODO(mgoddard): Remove --base-tag argument when CentOS 8 is the - # default. - self.build_args.extend(["--base", "centos", - "--base-tag", "8", - "--type", "binary"]) - - -class BuildTestCentos8Source(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestCentos8Source, self).setUp() - # TODO(mgoddard): Remove --base-tag argument when CentOS 8 is the - # default. - self.build_args.extend(["--base", "centos", - "--base-tag", "8", - "--type", "source"]) - - -class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestUbuntuBinary, self).setUp() - self.build_args.extend(["--base", "ubuntu", - "--type", "binary"]) - - -class BuildTestUbuntuSource(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestUbuntuSource, self).setUp() - self.build_args.extend(["--base", "ubuntu", - "--type", "source"]) - - -class BuildTestDebianBinary(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestDebianBinary, self).setUp() - self.build_args.extend(["--base", "debian", - "--type", "binary"]) - - -class BuildTestDebianSource(BuildTest, base.BaseTestCase): - - def setUp(self): - super(BuildTestDebianSource, self).setUp() - self.build_args.extend(["--base", "debian", - "--type", "source"]) |
