summaryrefslogtreecommitdiff
path: root/test/varlink/run_varlink_tests.sh
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2018-04-24 18:42:59 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-27 14:11:13 +0000
commit32db403b5e4fdb96e727e8cda3922d235ad63aa4 (patch)
treee8a397d1c221a4c9cc1a66ffa9b7742c4474b5cb /test/varlink/run_varlink_tests.sh
parent37619de39abea9f6802b0f42e2be7dd142c516ed (diff)
downloadpodman-32db403b5e4fdb96e727e8cda3922d235ad63aa4.tar.gz
podman-32db403b5e4fdb96e727e8cda3922d235ad63aa4.tar.bz2
podman-32db403b5e4fdb96e727e8cda3922d235ad63aa4.zip
Refactor unittest for varlink component
- Allow unittest's to run as normal user - Refactor tests to use unittest features - Refactor tests to use fixtures to track resources - Update test runner script to clean up on failure Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #683 Approved by: rhatdan
Diffstat (limited to 'test/varlink/run_varlink_tests.sh')
-rwxr-xr-x[-rw-r--r--]test/varlink/run_varlink_tests.sh50
1 files changed, 24 insertions, 26 deletions
diff --git a/test/varlink/run_varlink_tests.sh b/test/varlink/run_varlink_tests.sh
index 9c247fec2..8372de10b 100644..100755
--- a/test/varlink/run_varlink_tests.sh
+++ b/test/varlink/run_varlink_tests.sh
@@ -1,37 +1,35 @@
#!/bin/bash
-set -x
if [ ! -n "${PYTHON+ }" ]; then
- if hash python3 > /dev/null 2>&1 /dev/null; then
- PYTHON=$(hash -t python3)
- elif type python3 > /dev/null 2>&1; then
- PYTHON=$(type python3 | awk '{print $3}')
- elif hash python2 > /dev/null 2>&1; then
- PYTHON=$(hash -t python2)
- elif type python2 > /dev/null 2>&1; then
- PYTHON=$(type python2 | awk '{print $3}')
- else
- PYTHON='/usr/bin/python'
- fi
+ if hash python3 > /dev/null 2>&1; then
+ PYTHON=$(hash -t python3)
+ elif type python3 > /dev/null 2>&1; then
+ PYTHON=$(type python3 | awk '{print $3}')
+ elif hash python2 > /dev/null 2>&1; then
+ PYTHON=$(hash -t python2)
+ elif type python2 > /dev/null 2>&1; then
+ PYTHON=$(type python2 | awk '{print $3}')
+ else
+ PYTHON='/usr/bin/python'
+ fi
fi
# Create temporary directory for storage
-TMPSTORAGE=`mktemp -d`
-
-# Need a location to store the podman socket
-mkdir /run/podman
+TMPSTORAGE=`mktemp -d /tmp/podman.XXXXXXXXXX`
+trap 'rm -fr ${TMPSTORAGE}' EXIT
-# Run podman in background without systemd for test purposes
-bin/podman --storage-driver=vfs --root=${TMPSTORAGE}/crio --runroot=${TMPSTORAGE}/crio-run varlink unix:/run/podman/io.projectatomic.podman&
+export PODMAN_HOST="unix:${TMPSTORAGE}/podman/io.projectatomic.podman"
-# Record podman's pid to be killed later
-PODMAN_PID=`echo $!`
+# Need a location to store the podman socket
+mkdir -p ${TMPSTORAGE}/podman
-# Run tests
-${PYTHON} -m unittest discover -s test/varlink/
+systemd-cat -t podman -p notice bin/podman --version
-# Kill podman
-kill -9 ${PODMAN_PID}
+set -x
+# Run podman in background without systemd for test purposes
+systemd-cat -t podman -p notice \
+ bin/podman --storage-driver=vfs --root=${TMPSTORAGE}/crio \
+ --runroot=${TMPSTORAGE}/crio-run varlink ${PODMAN_HOST} &
-# Clean up
-rm -fr ${TMPSTORAGE}
+${PYTHON} -m unittest discover -s test/varlink/ $@
+pkill podman