diff --git a/podman.spec b/podman.spec index 56d709e..4479341 100644 --- a/podman.spec +++ b/podman.spec @@ -44,7 +44,7 @@ Epoch: 2 Epoch: 1 %endif Version: 1.2.0 -Release: 15.dev.git%{shortcommit0}%{?dist} +Release: 16.dev.git%{shortcommit0}%{?dist} Summary: Manage Pods, Containers and Container Images License: ASL 2.0 URL: https://podman.io/ @@ -197,7 +197,7 @@ Conflicts: docker Conflicts: docker-latest Conflicts: docker-ce Conflicts: docker-ee -Conflicts: moby-engine +Conflicts: moby-engine %description docker This package installs a script named docker that emulates the Docker CLI by @@ -364,6 +364,18 @@ This package contains unit tests for project providing packages with %{import_path} prefix. %endif +%package tests +Summary: Tests for %{name} + +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: bats +Requires: jq + +%description tests +%{summary} + +This package contains system tests for %{name} + %prep %autosetup -Sgit -n %{repo}-%{commit0} @@ -472,13 +484,16 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %if ! 0%{?gotest:1} %global gotest go test %endif - + %gotest %{import_path}/cmd/%{name} %gotest %{import_path}/libkpod %gotest %{import_path}/libpod %gotest %{import_path}/pkg/registrar %endif +install -d -p %{buildroot}/%{_datadir}/%{name}/test/system +cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/ + #define license tag if not already defined %{!?_licensedir:%global license %doc} @@ -517,7 +532,14 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} podman system renumber exit 0 +%files tests +%license LICENSE +%{_datadir}/%{name}/test + %changelog +* Wed Mar 13 2019 Eduardo Santiago - 2:1.2.0-16.dev.git883566f +- new -tests subpackage + * Wed Mar 13 2019 Lokesh Mandvekar (Bot) - 2:1.2.0-15.dev.git883566f - autobuilt 883566f @@ -1299,4 +1321,3 @@ containernetworking-cni * Wed Jan 10 2018 Frantisek Kluknavsky - 0-0.1.gitc1b2278 - First package for Fedora - diff --git a/tests/test_podman.sh b/tests/test_podman.sh index abb33cb..da220bf 100755 --- a/tests/test_podman.sh +++ b/tests/test_podman.sh @@ -3,80 +3,11 @@ # Simple podman tests # -set -x +rm -f /tmp/test.log /tmp/test.debug.log -exec >/tmp/test.debug.log 2>&1 +# Log program versions +rpm -q podman podman-tests >/tmp/test.debug.log -echo "************************************************************************" -echo "* This log contains the debug output from test_podman.sh." -echo "*" -echo "* Short test PASS/FAIL summary is in test.log" -echo "************************************************************************" +bats /usr/share/podman/test/system &> /tmp/test.log -rm -f /tmp/test.log -touch /tmp/test.log - -counter_file=/tmp/test.counter.txt -echo 0 >| $counter_file - -do_test() { - local cmd="$1"; shift - local expected_status="$1"; shift - local expected_stdout="$1"; shift - - counter=$(expr $(< $counter_file) + 1) - echo $counter >| $counter_file - - # Make debug log easier to read - echo - echo "--------------------------------------------------------------------" - echo "-- test $counter" - echo - - stdout=$(eval podman $cmd) - status=$? - if [ $status -ne $expected_status ]; then - echo "FAIL $counter $cmd: status=$status (expected $expected_status)" >>/tmp/test.log - return - fi - - if [ "$expected_stdout" = "-" ]; then - : - elif [ -z "$expected_stdout" ]; then - if [ -n "$stdout" ]; then - echo "FAIL $counter $cmd : stdout='$stdout' (expected '')" >>/tmp/test.log - return - fi - else - if ! expr "$stdout" : "$expected_stdout"; then - echo "FAIL $counter $cmd : stdout='$stdout' (expected '$expected_stdout')" >>/tmp/test.log - return - fi - fi - - echo "PASS $counter $cmd" >>/tmp/test.log -} - -# Clean slate -do_test "rm -a -f" 0 "-" -do_test "rmi -a -f" 0 "-" - -do_test "info --format '{{.host.rootless}}'" 0 "false" -do_test "info --format '{{.store.GraphDriverName}}'" 0 "overlay" - -do_test "pull alpine" 0 "-" -do_test "images --format {{.Repository}}:{{.Tag}}" 0 \ - "docker.io/library/alpine:latest" - -do_test "run alpine sh -c 'echo hi'" 0 "hi" -do_test "run alpine date" 0 "-" -do_test "run alpine /bin/false" 1 "" - -do_test "ps -a | wc -l" 0 "4" -do_test "ps -a | grep false | grep -q 'Exited (1)'" 0 "" - -# Final exit status: nonzero if the word FAIL is present in results -if grep -q FAIL /tmp/test.log; then - exit 1 -fi -exit 0 +echo "bats completed with status $?" >>/tmp/test.debug.log diff --git a/tests/test_podman.yml b/tests/test_podman.yml index f77c322..694b6d6 100644 --- a/tests/test_podman.yml +++ b/tests/test_podman.yml @@ -2,8 +2,15 @@ - 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 + - podman-tests tags: - classic - container @@ -14,6 +21,7 @@ enablerepo=updates-testing - block: + # FIXME: how to make two passes, one as root and one rootless? - name: Run test script: ./test_podman.sh always: