Skip to content

Commit

Permalink
ci: fix and improve integration container testing
Browse files Browse the repository at this point in the history
Use the vault for centos 7 and centos stream 8

Exclude tests/tests_team_plugin_installation_nm.yml since
tests/tests_team_nm.yml is excluded.

Use grouping to group log lines for better readability.
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Aug 15, 2024
1 parent 931cdb3 commit 89d7148
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/Dockerfile.c7-network-role
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM quay.io/centos/centos:centos7

RUN yum -y install epel-release && \
RUN yum -y install https://dl.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm && \
sed -i '/^mirror/d;s/#\?\(baseurl=http:\/\/\)mirror/\1vault/' /etc/yum.repos.d/*.repo && \
yum -y upgrade && \
yum -y install NetworkManager NetworkManager-wifi \
procps-ng iproute ansible openssh-server openssh-clients \
Expand Down
3 changes: 2 additions & 1 deletion .github/Dockerfile.c8s-network-role
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM quay.io/centos/centos:stream8

RUN dnf -y install dnf-plugins-core epel-release && \
RUN sed -i '/^mirror/d;s/#\(baseurl=http:\/\/\)mirror/\1vault/' /etc/yum.repos.d/*.repo && \
dnf -y install dnf-plugins-core epel-release && \
dnf config-manager --set-enabled powertools && \
dnf -y upgrade && \
dnf -y install NetworkManager NetworkManager-wifi \
Expand Down
15 changes: 15 additions & 0 deletions .github/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ EXCLUDE_TESTS_C7='
-e tests/tests_bond_removal_initscripts.yml
-e tests/tests_infiniband_nm.yml
-e tests/tests_team_nm.yml
-e tests/tests_team_plugin_installation_nm.yml
-e tests/tests_unit.yml
-e tests/tests_wireless_nm.yml
'
Expand All @@ -37,6 +38,7 @@ EXCLUDE_TESTS_C8S='
-e tests/tests_infiniband_nm.yml
-e tests/tests_integration_pytest.yml
-e tests/tests_team_nm.yml
-e tests/tests_team_plugin_installation_nm.yml
-e tests/tests_unit.yml
-e tests/tests_wireless_wpa3_owe_nm.yml
-e tests/tests_wireless_wpa3_sae_nm.yml
Expand All @@ -52,6 +54,7 @@ EXCLUDE_TESTS_C9S='
-e tests/tests_provider_nm.yml
-e tests/tests_regression_nm.yml
-e tests/tests_team_nm.yml
-e tests/tests_team_plugin_installation_nm.yml
-e tests/tests_unit.yml
-e tests/tests_wireless_wpa3_owe_nm.yml
-e tests/tests_wireless_wpa3_sae_nm.yml
Expand Down Expand Up @@ -107,6 +110,8 @@ EOF
;;
esac

echo "::group::Start test container"

# shellcheck disable=SC2086
CONTAINER_ID=$(podman run -d $PODMAN_OPTS \
-v "$PROJECT_PATH":$TEST_SOURCE_DIR $CONTAINER_IMAGE)
Expand All @@ -116,6 +121,8 @@ if [ -z "$CONTAINER_ID" ];then
exit 1
fi

echo ::endgroup::

function clean_up {
podman rm -f "$CONTAINER_ID" || true
}
Expand All @@ -124,6 +131,8 @@ if [ -z "${DEBUG:-}" ];then
trap clean_up ERR EXIT
fi

echo "::group::Set up container for testing"

# Ensure we are testing the latest packages and ignore upgrade failure
sudo podman exec -i "$CONTAINER_ID" /bin/bash -c 'dnf upgrade -y' || true

Expand Down Expand Up @@ -163,16 +172,22 @@ for req in meta/collection-requirements.yml tests/collection-requirements.yml; d
fi"
done

echo ::endgroup::

for test_file in $TEST_FILES; do
echo "::group::Test $test_file"
podman exec -i "$CONTAINER_ID" \
/bin/bash -c \
"cd $TEST_SOURCE_DIR;
env ANSIBLE_HOST_KEY_CHECKING=False \
ansible-playbook -i localhost, \
$test_file"
echo ::endgroup::
done

if [ -n "${DEBUG:-}" ];then
echo "::group::Cleanup"
podman exec -it "$CONTAINER_ID" bash
clean_up
echo ::endgroup::
fi

0 comments on commit 89d7148

Please sign in to comment.