mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
ci: get rid of integration tests - broken, unmaintained
The container based integration tests are broken and unmaintained. We don't need them anymore anyway. If you want to run tests in a container, use tox-lsr. https://github.com/linux-system-roles/tox-lsr?tab=readme-ov-file#container-testing Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
parent
c0b8196731
commit
d1083aa289
6 changed files with 0 additions and 310 deletions
12
.github/Dockerfile.c7-network-role
vendored
12
.github/Dockerfile.c7-network-role
vendored
|
|
@ -1,12 +0,0 @@
|
|||
FROM quay.io/centos/centos:centos7
|
||||
|
||||
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 \
|
||||
dnsmasq hostapd wpa_supplicant openssl ethtool iputils && yum clean all
|
||||
|
||||
VOLUME [ "/sys/fs/cgroup" ]
|
||||
|
||||
CMD ["/usr/sbin/init"]
|
||||
13
.github/Dockerfile.c8s-network-role
vendored
13
.github/Dockerfile.c8s-network-role
vendored
|
|
@ -1,13 +0,0 @@
|
|||
FROM quay.io/centos/centos:stream8
|
||||
|
||||
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 \
|
||||
procps-ng iproute ansible openssh-server openssh-clients systemd-udev \
|
||||
dnsmasq hostapd wpa_supplicant openssl ethtool iputils python3-gobject-base
|
||||
|
||||
VOLUME [ "/sys/fs/cgroup" ]
|
||||
|
||||
CMD ["/usr/sbin/init"]
|
||||
14
.github/Dockerfile.c9s-network-role
vendored
14
.github/Dockerfile.c9s-network-role
vendored
|
|
@ -1,14 +0,0 @@
|
|||
FROM quay.io/centos/centos:stream9-development
|
||||
|
||||
RUN dnf -y install dnf-plugins-core && \
|
||||
dnf config-manager --set-enabled crb && \
|
||||
dnf -y upgrade && \
|
||||
dnf -y install NetworkManager NetworkManager-wifi \
|
||||
procps-ng iproute openssh-server openssh-clients systemd-udev \
|
||||
dnsmasq wpa_supplicant openssl ethtool iputils python3-gobject-base \
|
||||
python3-pip python3-jmespath && \
|
||||
pip3 install ansible==2.9.*
|
||||
|
||||
VOLUME [ "/sys/fs/cgroup" ]
|
||||
|
||||
CMD ["/usr/sbin/init"]
|
||||
193
.github/run_test.sh
vendored
193
.github/run_test.sh
vendored
|
|
@ -1,193 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
TEST_SOURCE_DIR="/network-role"
|
||||
C8S_CONTAINER_IMAGE="quay.io/linux-system-roles/c8s-network-role"
|
||||
C7_CONTAINER_IMAGE="quay.io/linux-system-roles/c7-network-role"
|
||||
C9S_CONTAINER_IMAGE="quay.io/linux-system-roles/c9s-network-role"
|
||||
PODMAN_OPTS="--systemd=true --privileged"
|
||||
|
||||
# exclude bond tests since missing the bonding kernel module
|
||||
# exclude tests/tests_wireless_nm.yml since failing to load mac80211_hwsim kernel
|
||||
# module to mock a wifi network
|
||||
# exclude tests/tests_infiniband_nm.yml since missing the infiniband device
|
||||
EXCLUDE_TESTS_C7='
|
||||
-e tests/tests_auto_gateway_initscripts.yml
|
||||
-e tests/tests_bond_deprecated_initscripts.yml
|
||||
-e tests/tests_bond_initscripts.yml
|
||||
-e tests/tests_bond_cloned_mac_initscripts.yml
|
||||
-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
|
||||
'
|
||||
|
||||
# exclude bond tests since missing the bonding kernel module
|
||||
# exclude tests/tests_wireless_wpa3_owe_nm.yml and tests/tests_wireless_wpa3_sae_nm.yml
|
||||
# since failing to install mac80211_hwsim kernel module
|
||||
# exclude tests/tests_infiniband_nm.yml since missing the infiniband device
|
||||
EXCLUDE_TESTS_C8S='
|
||||
-e tests/tests_auto_gateway_initscripts.yml
|
||||
-e tests/tests_bond_deprecated_initscripts.yml
|
||||
-e tests/tests_bond_initscripts.yml
|
||||
-e tests/tests_bond_cloned_mac_initscripts.yml
|
||||
-e tests/tests_bond_removal_initscripts.yml
|
||||
-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
|
||||
'
|
||||
|
||||
# exclude tests_provider_nm.yml and tests_regression_nm.yml since no package
|
||||
# network-scripts available
|
||||
# exclude tests/tests_wireless_wpa3_owe_nm.yml and tests/tests_wireless_wpa3_sae_nm.yml
|
||||
# since failing to install mac80211_hwsim kernel module
|
||||
# exclude tests/tests_infiniband_nm.yml since missing the infiniband device
|
||||
EXCLUDE_TESTS_C9S='
|
||||
-e tests/tests_infiniband_nm.yml
|
||||
-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
|
||||
'
|
||||
|
||||
EXEC_PATH=$(dirname "$(realpath "$0")")
|
||||
PROJECT_PATH=$(dirname "$(realpath "$EXEC_PATH../")")
|
||||
|
||||
# Default
|
||||
OS_TYPE=c8s
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
--os)
|
||||
OS_TYPE=$2
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
*) # unknown option
|
||||
echo "Unknown option, please try $1 --os c8s"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $OS_TYPE in
|
||||
"c8s")
|
||||
CONTAINER_IMAGE=$C8S_CONTAINER_IMAGE
|
||||
# shellcheck disable=SC2086
|
||||
read -r -d '' TEST_FILES <<EOF || :
|
||||
$(find tests/tests_*.yml | grep -E -v ${EXCLUDE_TESTS_C8S})
|
||||
EOF
|
||||
;;
|
||||
"c7")
|
||||
CONTAINER_IMAGE=$C7_CONTAINER_IMAGE
|
||||
# shellcheck disable=SC2086
|
||||
read -r -d '' TEST_FILES <<EOF || :
|
||||
$(find tests/tests_*.yml | grep -E -v ${EXCLUDE_TESTS_C7})
|
||||
EOF
|
||||
;;
|
||||
"c9s")
|
||||
CONTAINER_IMAGE=$C9S_CONTAINER_IMAGE
|
||||
# shellcheck disable=SC2086
|
||||
read -r -d '' TEST_FILES <<EOF || :
|
||||
$(find tests/tests_*.yml | grep -E -v ${EXCLUDE_TESTS_C9S})
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported OS type $OS_TYPE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "::group::Start test container"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
CONTAINER_ID=$(podman run -d $PODMAN_OPTS \
|
||||
-v "$PROJECT_PATH":$TEST_SOURCE_DIR $CONTAINER_IMAGE)
|
||||
|
||||
if [ -z "$CONTAINER_ID" ];then
|
||||
echo "Failed to start container"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ::endgroup::
|
||||
|
||||
function clean_up {
|
||||
podman rm -f "$CONTAINER_ID" || true
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'while ! systemctl is-active dbus; do sleep 1; done'
|
||||
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c 'sysctl -w net.ipv6.conf.all.disable_ipv6=0'
|
||||
|
||||
sudo podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'systemctl start systemd-udevd;
|
||||
while ! systemctl is-active systemd-udevd; do sleep 1; done'
|
||||
|
||||
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'systemctl restart NetworkManager;
|
||||
while ! systemctl is-active NetworkManager; do sleep 1; done'
|
||||
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'systemctl restart sshd;
|
||||
while ! systemctl is-active sshd; do sleep 1; done'
|
||||
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
'cat /dev/zero | ssh-keygen -q -N "";
|
||||
cp -v /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys'
|
||||
|
||||
for req in meta/collection-requirements.yml tests/collection-requirements.yml; do
|
||||
podman exec -i "$CONTAINER_ID" \
|
||||
/bin/bash -c \
|
||||
"if [ -f $TEST_SOURCE_DIR/$req ]; then \
|
||||
ansible-galaxy collection install -vv -r $TEST_SOURCE_DIR/$req; \
|
||||
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
|
||||
30
.github/workflows/integration.yml
vendored
30
.github/workflows/integration.yml
vendored
|
|
@ -1,30 +0,0 @@
|
|||
name: integration
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
merge_group:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- checks_requested
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: "c7"
|
||||
- os: "c8s"
|
||||
- os: "c9s"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run tests
|
||||
run: sudo .github/run_test.sh --os ${{ matrix.os }}
|
||||
|
|
@ -70,51 +70,3 @@ ansible-playbook --skip-tags tests::cleanup \
|
|||
|
||||
[NM 1.0](https://lazka.github.io/pgi-docs/#NM-1.0), it contains a full
|
||||
explanation about the NetworkManager API.
|
||||
|
||||
### Integration tests with podman
|
||||
|
||||
1. Create `~/.ansible/collections/ansible_collections/containers/podman/` if this
|
||||
directory does not exist and `cd` into this directory.
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.ansible/collections/ansible_collections/containers/podman/
|
||||
cd ~/.ansible/collections/ansible_collections/containers/podman/
|
||||
```
|
||||
|
||||
2. Clone the collection plugins for Ansible-Podman into the current directory.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/containers/ansible-podman-collections.git .
|
||||
```
|
||||
|
||||
3. Change directory into the `tests` subdirectory.
|
||||
|
||||
```bash
|
||||
cd ~/network/tests
|
||||
```
|
||||
|
||||
4. Use podman with `-d` to run in the background (daemon). Use `c7` because
|
||||
`centos/systemd` is centos7.
|
||||
|
||||
```bash
|
||||
podman run --name lsr-ci-c7 --rm --privileged \
|
||||
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
|
||||
-d registry.centos.org/centos/systemd
|
||||
```
|
||||
|
||||
5. Use `podman unshare` first to run "podman mount" in root mode, use `-vi` to
|
||||
run ansible as inventory in verbose mode, use `-c podman` to use the podman
|
||||
connection plugin. NOTE: Some of the tests do not work with podman - see
|
||||
`.github/run_test.sh` for the list of tests that do not work.
|
||||
|
||||
```bash
|
||||
podman unshare
|
||||
ansible-playbook -vi lsr-ci-c7, -c podman tests_provider_nm.yml
|
||||
```
|
||||
|
||||
6. NOTE that this leaves the container running in the background, to kill it:
|
||||
|
||||
```bash
|
||||
podman stop lsr-ci-c7
|
||||
podman rm lsr-ci-c7
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue