Skip to content

Commit

Permalink
ci: Add coverage for all address family combinations.
Browse files Browse the repository at this point in the history
To achieve this, split the CirrusCI job into two tasks:
- one preparing the runtime (for both supported OS versions)
- another one running the tests (defined as a matrix to test all
combinations of IC/non-IC dual/single-stack).

As each task is run in a separate VM instance, we need a way to install
dependencies in the second VM; for that we extend do.sh with a command
option to "install-deps".

Due to the fact that the second set of tasks, low_scale_task, need to
use exactly the runtime built by the commit's runtime_builder_task we
need to explicitly tag all caches with the CirrusCI build ID.  This has
the unfortunate side effect that we can't cache the same runtime across
multiple commits.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
dceara committed Oct 23, 2023
1 parent fc2d60e commit ac3cba3
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 32 deletions.
98 changes: 79 additions & 19 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
low_scale_task:

compute_engine_instance:
matrix:
- image_project: fedora-cloud
image: family/fedora-cloud-38
- image_project: ubuntu-os-cloud
image: family/ubuntu-2304-amd64
platform: linux
memory: 8G
disk: 40

common_task_template: &COMMON_TASK_TEMPLATE
env:
DEPENDENCIES: git ansible podman
FEDORA_DEP: ansible-collection-ansible-posix
ansible-collection-ansible-utils
CIRRUS_WORKING_DIR: /root/ovn-heater
PHYS_DEPLOYMENT: ${CIRRUS_WORKING_DIR}/physical-deployments/ci.yml

runtime_cache:
folder: runtime-cache

# Make sure we use all the disk available to us. Similar to the steps
# described at:
# https://cloud.google.com/compute/docs/disks/resize-persistent-disk
Expand Down Expand Up @@ -53,6 +39,26 @@ low_scale_task:
apt update && apt install -y ${DEPENDENCIES};
fi'

runtime_builder_task:
<< : *COMMON_TASK_TEMPLATE

compute_engine_instance:
matrix:
- image_project: fedora-cloud
image: family/fedora-cloud-38
- image_project: ubuntu-os-cloud
image: family/ubuntu-2304-amd64
platform: linux
memory: 8G
disk: 40

runtime_cache:
folder: runtime-cache
fingerprint_script:
- echo ${CIRRUS_BUILD_ID}
- echo ${CIRRUS_OS}
- awk -F= '/^ID/{print$2}' /etc/os-release | tr -d '"'

unpack_caches_script:
- mkdir -p runtime runtime-cache
- tar -xzf runtime-cache/runtime.tar.gz || true
Expand All @@ -69,11 +75,65 @@ low_scale_task:
upload_caches:
- runtime

low_scale_task:
depends_on:
- runtime_builder

<< : *COMMON_TASK_TEMPLATE

compute_engine_instance:
matrix:
- image_project: fedora-cloud
image: family/fedora-cloud-38
- image_project: ubuntu-os-cloud
image: family/ubuntu-2304-amd64
platform: linux
memory: 8G
disk: 40

matrix:
- name: 'Test Scenario - non IC'
env:
TEST_SCENARIO: 'test-scenarios/ovn-low-scale.yml'
TEST_SCENARIO_OUTDIR: 'low-scale'
- name: 'Test Scenario - IC'
env:
TEST_SCENARIO: 'test-scenarios/ovn-low-scale-ic.yml'
TEST_SCENARIO_OUTDIR: 'low-scale-ic'

matrix:
- name: 'Address Family - dual'
env:
IP4: True
IP6: True
- name: 'Address Family - ip4'
env:
IP4: True
IP6: False
- name: 'Address Family - ip6'
env:
IP4: False
IP6: True

runtime_cache:
folder: runtime-cache
fingerprint_script:
- echo ${CIRRUS_BUILD_ID}
- echo ${CIRRUS_OS}
- awk -F= '/^ID/{print$2}' /etc/os-release | tr -d '"'

unpack_caches_script:
- tar -xzf runtime-cache/runtime.tar.gz
- podman load -i runtime/ovn-fake-multinode/ovn-multi-node-image.tar

test_script:
- 'sed -i "s/^ log_cmds\: False/ log_cmds\: True/"
test-scenarios/ovn-low-scale*.yml'
- ./do.sh run test-scenarios/ovn-low-scale.yml low-scale
- ./do.sh run test-scenarios/ovn-low-scale-ic.yml low-scale-ic
- 'sed -i "s/<host>/$(hostname)/g" ${PHYS_DEPLOYMENT}'
- 'sed -i "s/^ log_cmds\: False/ log_cmds\: True/" ${TEST_SCENARIO}'
- 'sed -i "s/^ run_ipv4\: .*\$/ run_ipv4\: $IP4/" ${TEST_SCENARIO}'
- 'sed -i "s/^ run_ipv6\: .*\$/ run_ipv6\: $IP6/" ${TEST_SCENARIO}'
- ./do.sh install-deps
- ./do.sh refresh-tester
- ./do.sh run ${TEST_SCENARIO} ${TEST_SCENARIO_OUTDIR}

check_logs_script:
- ./utils/logs-checker.sh
Expand Down
40 changes: 27 additions & 13 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,38 @@ function generate() {
}

function install_deps_local_rpm() {
echo "-- Installing local dependencies"
yum install redhat-lsb-core datamash \
python3-netaddr python3 python3-devel \
podman \
--skip-broken -y
}

function install_deps_local_deb() {
echo "-- Installing local dependencies"
apt -y install datamash podman \
python3-netaddr python3 python3-all-dev python3-venv
}

function install_deps_local() {
echo "-- Installing local dependencies"
pushd ${rundir}
if is_rpm_based
then
install_deps_local_rpm
elif is_deb_based
then
install_deps_local_deb
else
die_distro
fi
popd
}

function install_deps_remote() {
echo "-- Installing dependencies on all nodes"
pushd ${rundir}
ansible-playbook ${ovn_fmn_playbooks}/install-dependencies.yml \
-i ${hosts_file}
popd
}

function install_venv() {
Expand Down Expand Up @@ -296,17 +311,9 @@ function pull_ovn_tester() {
}

function install() {
pushd ${rundir}
if is_rpm_based
then
install_deps_local_rpm
elif is_deb_based
then
install_deps_local_deb
else
die_distro
fi
install_deps_local
install_deps_remote
pushd ${rundir}
install_venv
install_ovn_fake_multinode
init_ovn_fake_multinode
Expand Down Expand Up @@ -501,7 +508,7 @@ function run_test() {
}

function usage() {
die "Usage: $0 install|generate|init|refresh-tester|run <scenario> <out-dir>"
die "Usage: $0 install|install-deps|generate|init|refresh-tester|run <scenario> <out-dir>"
}

do_lockfile=/tmp/do.sh.lock
Expand All @@ -514,6 +521,8 @@ function take_lock() {
case "${1:-"usage"}" in
"install")
;&
"install-deps")
;&
"generate")
;&
"init")
Expand Down Expand Up @@ -545,6 +554,11 @@ case "${1:-"usage"}" in
) >> ${installer_log_file}
install 2>&1 | tee -a ${installer_log_file}
;;
"install-deps")
generate
install_deps_local
install_deps_remote
;;
"generate")
generate
;;
Expand Down

0 comments on commit ac3cba3

Please sign in to comment.