aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zuul.d/base.yaml1
-rw-r--r--.zuul.d/centos.yaml2
-rw-r--r--.zuul.d/debian.yaml3
-rw-r--r--.zuul.d/ubuntu.yaml2
-rw-r--r--tests/playbooks/pre.yml17
-rw-r--r--tests/playbooks/run.yml6
-rw-r--r--tests/templates/kolla-build.conf.j25
-rw-r--r--tests/test_build.py133
-rw-r--r--tox.ini80
9 files changed, 22 insertions, 227 deletions
diff --git a/.zuul.d/base.yaml b/.zuul.d/base.yaml
index 5d045661e..f8a7c7c12 100644
--- a/.zuul.d/base.yaml
+++ b/.zuul.d/base.yaml
@@ -72,3 +72,4 @@
extra-vars:
kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla"
kolla_build_logs_dir: "{{ kolla_logs_dir }}/build"
+ virtualenv_path: "/tmp/kolla-virtualenv"
diff --git a/.zuul.d/centos.yaml b/.zuul.d/centos.yaml
index 7842dbed8..f219b1c3d 100644
--- a/.zuul.d/centos.yaml
+++ b/.zuul.d/centos.yaml
@@ -49,7 +49,6 @@
nodeset: kolla-centos8
voting: false
vars:
- action: build
base_distro: centos
install_type: binary
@@ -67,7 +66,6 @@
parent: kolla-base
nodeset: kolla-centos8
vars:
- action: build
base_distro: centos
install_type: source
diff --git a/.zuul.d/debian.yaml b/.zuul.d/debian.yaml
index db3266ddb..64058d69c 100644
--- a/.zuul.d/debian.yaml
+++ b/.zuul.d/debian.yaml
@@ -24,7 +24,6 @@
nodeset: kolla-debian-buster
voting: false
vars:
- action: build
base_distro: debian
install_type: source
@@ -34,7 +33,6 @@
nodeset: kolla-debian-buster-aarch64
voting: false
vars:
- action: build
base_distro: debian
install_type: source
@@ -44,7 +42,6 @@
nodeset: kolla-debian-buster
voting: false
vars:
- action: build
base_distro: debian
install_type: binary
diff --git a/.zuul.d/ubuntu.yaml b/.zuul.d/ubuntu.yaml
index 8ed20990b..daae673d5 100644
--- a/.zuul.d/ubuntu.yaml
+++ b/.zuul.d/ubuntu.yaml
@@ -37,7 +37,6 @@
nodeset: kolla-ubuntu-bionic
voting: false
vars:
- action: build
base_distro: ubuntu
install_type: binary
@@ -55,7 +54,6 @@
parent: kolla-base
nodeset: kolla-ubuntu-bionic
vars:
- action: build
base_distro: ubuntu
install_type: source
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"])
diff --git a/tox.ini b/tox.ini
index d94bd279e..fa71e4263 100644
--- a/tox.ini
+++ b/tox.ini
@@ -88,86 +88,6 @@ commands =
sphinx-build -W --keep-going -b latex doc/source doc/build/pdf
make -C doc/build/pdf
-[testenv:build-centos-binary]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestCentosBinary
-
-[testenv:build-centos-source]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestCentosSource
-
-[testenv:build-centos8-binary]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestCentos8Binary
-
-[testenv:build-centos8-source]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestCentos8Source
-
-[testenv:build-ubuntu-binary]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestUbuntuBinary
-
-[testenv:build-ubuntu-source]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestUbuntuSource
-
-[testenv:build-debian-binary]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestDebianBinary
-
-[testenv:build-debian-source]
-whitelist_externals = find
- bash
-setenv =
- DOCKER_BUILD_TEST=1
-commands =
- find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
- bash -c "if [ ! -d .stestr ]; then stestr init; fi"
- stestr run test_build.BuildTestDebianSource
-
[testenv:genconfig]
whitelist_externals = which
commands=