From eda49e3b38ecf617a320eaa57bb3cab2a7db98fe Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Tue, 8 Sep 2020 08:44:42 -0400 Subject: [PATCH] Document running integration tests with podman Document how to run integration test with podman, and list the files that are currently not working with podman. Signed-off-by: Wen Liang --- contributing.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/contributing.md b/contributing.md index c3c4959..366c2c2 100644 --- a/contributing.md +++ b/contributing.md @@ -289,6 +289,64 @@ ansible-playbook --skip-tags tests::cleanup \ -i testhost, tests/playbooks/tests_802_1x.yml ``` +### 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 `network/tests`, `network` is the Repo you cloned from +your local fork. +```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 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 collection plugins. Note, +the following tests are currently not working with podman: +- `tests_802_1x_nm.yml` +- `tests_802_1x_updated_nm.yml` +- `tests_bond_initscripts.yml` +- `tests_bond_nm.yml` +- `tests_bridge_initscripts.yml` +- `tests_bridge_nm.yml` +- `tests_default_nm.yml` +- `tests_ethernet_nm.yml` +- `tests_reapply_nm.yml` +- `tests_states_nm.yml` +- `tests_vlan_mtu_initscripts.yml` +- `tests_vlan_mtu_nm.yml` +- `tests_wireless_nm.yml` + +```bash +podman unshare +ansible-playbook -vi c7, -c podman tests_provider_nm.yml +``` + +6. NOTE that this leaves the container running in the background, to kill it: +```bash +> podman ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +02a45f9d53df registry.centos.org/centos/systemd:latest /usr/sbin/init 13 minutes ago Up 13 minutes ago c7 +> podman stop 02a45f9d53df +> podman rm 02a45f9d53df +``` + + ### Continuous integration The [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) (CI)