Skip to content

Commit

Permalink
.zuul, playbooks, test/system: Optimize the CI on Fedora nodes
Browse files Browse the repository at this point in the history
The test suite has expanded to 415 system tests.  These tests can be
very I/O intensive, because many of them copy OCI images from the test
suite's image cache directory to its local container/storage store,
create containers, and then delete everything to run the next test with
a clean slate.  This makes the system tests slow.

Unfortunately, Zuul's max-job-timeout setting defaults to an upper limit
of 3 hours or 10800 seconds for jobs [1], and this is what Software
Factory uses [2].  So, there comes a point beyond which the CI can't be
prevented from timing out by increasing the timeout.

One way of scaling past this maximum time limit is to run the tests in
parallel across multiple nodes.  This has been implemented by splitting
the system tests into different groups, which are run separately by
different nodes.

First, the tests were grouped into those that test commands and options
accepted by the toolbox(1) binary, and those that test the runtime
environment within the Toolbx containers.  The first group has more
tests, but runs faster, because many of them test error handling and
don't do much I/O.

The runtime environment tests take especially long on Fedora Rawhide
nodes, which are often slower than the stable Fedora nodes.  Possibly
because Rawhide uses Linux kernels that are built with debugging
enabled, which makes it slower.  Therefore, this group of tests were
further split for Rawhide nodes by the Toolbx images they use.  Apart
from reducing the number of tests in each group, this should also reduce
the amount of time spent in downloading the images.

The split has been implemented with Bats' tagging system that is
available from Bats 1.8.0 [3].  Fortunately, commit 87eaeea
already added a dependency on Bats >= 1.10.0.  So, there's nothing to
worry about.

At the moment, Bats doesn't expose the tags being used to run the test
suite to setup_suite() and teardown_suite() [4].  Therefore, the
TOOLBX_TEST_SYSTEM_TAGS environment variable was used to optimize the
contents of setup_suite().

[1] https://zuul-ci.org/docs/zuul/latest/tenants.html

[2] Commit 83f28c5
    83f28c52e47c2d44
    #1548

[3] https://bats-core.readthedocs.io/en/stable/writing-tests.html

[4] bats-core/bats-core#1006

#1551
  • Loading branch information
debarshiray committed Sep 27, 2024
1 parent e435704 commit 987f5e2
Show file tree
Hide file tree
Showing 27 changed files with 455 additions and 53 deletions.
126 changes: 98 additions & 28 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,71 +49,141 @@
run: playbooks/unit-test.yaml

- job:
name: system-test-fedora-rawhide
description: Run Toolbx's system tests in Fedora Rawhide
timeout: 10800
name: system-test-fedora-rawhide-commands-options
description: Run Toolbx's commands-options system tests in Fedora Rawhide
timeout: 7200
nodeset:
nodes:
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test.yaml
run: playbooks/system-test-commands-options.yaml

- job:
name: system-test-fedora-41
description: Run Toolbx's system tests in Fedora 41
timeout: 9000
name: system-test-fedora-rawhide-runtime-environment-arch-fedora
description: Run Toolbx's (arch-fedora,runtime-environment) system tests in Fedora Rawhide
timeout: 7200
nodeset:
nodes:
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-arch-fedora.yaml

- job:
name: system-test-fedora-rawhide-runtime-environment-ubuntu
description: Run Toolbx's (runtime-environment,ubuntu) system tests in Fedora Rawhide
timeout: 7200
nodeset:
nodes:
- name: fedora-rawhide
label: cloud-fedora-rawhide
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment-ubuntu.yaml

- job:
name: system-test-fedora-41-commands-options
description: Run Toolbx's commands-options system tests in Fedora 41
timeout: 6300
nodeset:
nodes:
- name: fedora-41
label: cloud-fedora-41
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test.yaml
run: playbooks/system-test-commands-options.yaml

- job:
name: system-test-fedora-40
description: Run Toolbx's system tests in Fedora 40
timeout: 9000
name: system-test-fedora-41-runtime-environment
description: Run Toolbx's runtime-environment system tests in Fedora 41
timeout: 6300
nodeset:
nodes:
- name: fedora-41
label: cloud-fedora-41
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment.yaml

- job:
name: system-test-fedora-40-commands-options
description: Run Toolbx's commands-options system tests in Fedora 40
timeout: 6300
nodeset:
nodes:
- name: fedora-40
label: cloud-fedora-40
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test.yaml
run: playbooks/system-test-commands-options.yaml

- job:
name: system-test-fedora-40-runtime-environment
description: Run Toolbx's runtime-environment system tests in Fedora 40
timeout: 6300
nodeset:
nodes:
- name: fedora-40
label: cloud-fedora-40
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-runtime-environment.yaml

- job:
name: system-test-fedora-39-commands-options
description: Run Toolbx's commands-options system tests in Fedora 39
timeout: 6300
nodeset:
nodes:
- name: fedora-39
label: cloud-fedora-39
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test-commands-options.yaml

- job:
name: system-test-fedora-39
description: Run Toolbx's system tests in Fedora 39
timeout: 9000
name: system-test-fedora-39-runtime-environment
description: Run Toolbx's runtime-environment system tests in Fedora 39
timeout: 6300
nodeset:
nodes:
- name: fedora-39
label: cloud-fedora-39
pre-run: playbooks/setup-env.yaml
run: playbooks/system-test.yaml
run: playbooks/system-test-runtime-environment.yaml

- project:
periodic:
jobs:
- system-test-fedora-rawhide
- system-test-fedora-41
- system-test-fedora-40
- system-test-fedora-39
- system-test-fedora-rawhide-commands-options
- system-test-fedora-rawhide-runtime-environment-arch-fedora
- system-test-fedora-rawhide-runtime-environment-ubuntu
- system-test-fedora-41-commands-options
- system-test-fedora-41-runtime-environment
- system-test-fedora-40-commands-options
- system-test-fedora-40-runtime-environment
- system-test-fedora-39-commands-options
- system-test-fedora-39-runtime-environment
check:
jobs:
- unit-test
- unit-test-migration-path-for-coreos-toolbox
- unit-test-restricted
- system-test-fedora-rawhide
- system-test-fedora-41
- system-test-fedora-40
- system-test-fedora-39
- system-test-fedora-rawhide-commands-options
- system-test-fedora-rawhide-runtime-environment-arch-fedora
- system-test-fedora-rawhide-runtime-environment-ubuntu
- system-test-fedora-41-commands-options
- system-test-fedora-41-runtime-environment
- system-test-fedora-40-commands-options
- system-test-fedora-40-runtime-environment
- system-test-fedora-39-commands-options
- system-test-fedora-39-runtime-environment
gate:
jobs:
- unit-test
- unit-test-migration-path-for-coreos-toolbox
- unit-test-restricted
- system-test-fedora-rawhide
- system-test-fedora-41
- system-test-fedora-40
- system-test-fedora-39
- system-test-fedora-rawhide-commands-options
- system-test-fedora-rawhide-runtime-environment-arch-fedora
- system-test-fedora-rawhide-runtime-environment-ubuntu
- system-test-fedora-41-commands-options
- system-test-fedora-41-runtime-environment
- system-test-fedora-40-commands-options
- system-test-fedora-40-runtime-environment
- system-test-fedora-39-commands-options
- system-test-fedora-39-runtime-environment
30 changes: 30 additions & 0 deletions playbooks/system-test-commands-options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright © 2021 – 2024 Red Hat, Inc.
#
# 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.
#

---
- hosts: all
tasks:
- include_tasks: build.yaml

- name: Run the commands-options system tests
command: bats --filter-tags commands-options ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'arch-fedora,commands-options,custom-image,ubuntu'
args:
chdir: '{{ zuul.project.src_dir }}'
30 changes: 30 additions & 0 deletions playbooks/system-test-runtime-environment-arch-fedora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright © 2021 – 2024 Red Hat, Inc.
#
# 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.
#

---
- hosts: all
tasks:
- include_tasks: build.yaml

- name: Run the (arch-fedora,runtime-environment) system tests
command: bats --filter-tags arch-fedora,runtime-environment ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'arch-fedora,runtime-environment'
args:
chdir: '{{ zuul.project.src_dir }}'
30 changes: 30 additions & 0 deletions playbooks/system-test-runtime-environment-ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright © 2021 – 2024 Red Hat, Inc.
#
# 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.
#

---
- hosts: all
tasks:
- include_tasks: build.yaml

- name: Run the (runtime-environment,ubuntu) system tests
command: bats --filter-tags runtime-environment,ubuntu ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'runtime-environment,ubuntu'
args:
chdir: '{{ zuul.project.src_dir }}'
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
tasks:
- include_tasks: build.yaml

- name: Run system tests
command: bats ./test/system
- name: Run the runtime-environment system tests
command: bats --filter-tags runtime-environment ./test/system
environment:
PODMAN: '/usr/bin/podman'
TMPDIR: '/var/tmp'
TOOLBX: '/usr/local/bin/toolbox'
TOOLBX_TEST_SYSTEM_TAGS: 'arch-fedora,runtime-environment,ubuntu'
args:
chdir: '{{ zuul.project.src_dir }}'
4 changes: 3 additions & 1 deletion test/system/001-version.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers.bash'

setup() {
bats_require_minimum_version 1.7.0
bats_require_minimum_version 1.8.0
_setup_environment
}

Expand Down
2 changes: 2 additions & 0 deletions test/system/002-help.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers.bash'
Expand Down
2 changes: 2 additions & 0 deletions test/system/101-create.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'
Expand Down
2 changes: 2 additions & 0 deletions test/system/102-list.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'
Expand Down
3 changes: 3 additions & 0 deletions test/system/103-container.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'

setup() {
bats_require_minimum_version 1.8.0
_setup_environment
cleanup_all
}
Expand Down
4 changes: 3 additions & 1 deletion test/system/104-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'

setup() {
bats_require_minimum_version 1.7.0
bats_require_minimum_version 1.8.0
_setup_environment
cleanup_all
pushd "$HOME" || return 1
Expand Down
3 changes: 3 additions & 0 deletions test/system/105-enter.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'

setup() {
bats_require_minimum_version 1.8.0
_setup_environment
cleanup_all
}
Expand Down
3 changes: 3 additions & 0 deletions test/system/106-rm.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'

setup() {
bats_require_minimum_version 1.8.0
_setup_environment
cleanup_all
}
Expand Down
4 changes: 3 additions & 1 deletion test/system/107-rmi.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# limitations under the License.
#

# bats file_tags=commands-options

load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load 'libs/helpers'

setup() {
bats_require_minimum_version 1.7.0
bats_require_minimum_version 1.8.0
_setup_environment
cleanup_all
}
Expand Down
Loading

0 comments on commit 987f5e2

Please sign in to comment.