From 096afbce0b117ce18737722ad96e613d79b3618e Mon Sep 17 00:00:00 2001 From: Bruno Goncalves Date: Fri, 19 Jul 2019 10:33:28 +0200 Subject: [PATCH] run tests using standard-test-basic role attempt to run the test also as rootless --- tests/test_podman.sh | 10 +++------ tests/test_podman.yml | 51 +++++++++++++++---------------------------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/tests/test_podman.sh b/tests/test_podman.sh index da220bf..5a339e9 100755 --- a/tests/test_podman.sh +++ b/tests/test_podman.sh @@ -1,13 +1,9 @@ -#!/bin/bash +#!/bin/bash -e # # Simple podman tests # -rm -f /tmp/test.log /tmp/test.debug.log - # Log program versions -rpm -q podman podman-tests >/tmp/test.debug.log +rpm -q podman podman-tests -bats /usr/share/podman/test/system &> /tmp/test.log - -echo "bats completed with status $?" >>/tmp/test.debug.log +bats /usr/share/podman/test/system diff --git a/tests/test_podman.yml b/tests/test_podman.yml index 694b6d6..0e00f56 100644 --- a/tests/test_podman.yml +++ b/tests/test_podman.yml @@ -1,35 +1,20 @@ --- - hosts: localhost - vars: - - artifacts: ./artifacts - # FIXME! It would be cleaner to include 'podman' in this list; but the - # dnf module is broken in ansible <= 2.8, it doesn't report failures - # to install as long as _one_ package installs! So if podman installs - # but podman-tests doesn't, the `dnf` stanza succeeds, then the test - # one fails with a less-than-helpful error. - # - # See https://github.com/ansible/ansible/pull/49760 - - required_packages: - - podman-tests - tags: - - classic - - container - - tasks: - - name: install packages - dnf: name="{{ required_packages }}" state=installed - enablerepo=updates-testing - - - block: - # FIXME: how to make two passes, one as root and one rootless? - - name: Run test - script: ./test_podman.sh - always: - - name: Pull out logs - fetch: - src: "/tmp/{{ item }}" - dest: "{{ artifacts }}/{{ item }}" - flat: yes - with_items: - - test.log - - test.debug.log + roles: + - role: standard-test-basic + tags: + - classic + - container + required_packages: + - bats + - podman + - podman-tests + tests: + - root-test: + dir: ./ + run: ./test_podman.sh + - rootless-test: + # running the test with su doesn't create the directory for fedora user on /run/user/ + # so create it manually + dir: ./ + run: mkdir /run/user/$(id -u fedora); su -c ${PWD}/test_podman.sh - fedora