run tests using standard-test-basic role

attempt to run the test also as rootless
This commit is contained in:
Bruno Goncalves 2019-07-19 10:33:28 +02:00
parent 44918635e2
commit 096afbce0b
2 changed files with 21 additions and 40 deletions

View File

@ -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

View File

@ -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