|
Carlos Rodriguez-Fernandez |
b4312e |
#!/bin/bash
|
|
Carlos Rodriguez-Fernandez |
b4312e |
# Author: Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>
|
|
Carlos Rodriguez-Fernandez |
b4312e |
|
|
Carlos Rodriguez-Fernandez |
b4312e |
t_Log "Running $0 - podman tests"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
|
|
Carlos Rodriguez-Fernandez |
b716f0 |
if [ "$centos_ver" -lt 8 ] ; then
|
|
Carlos Rodriguez-Fernandez |
b716f0 |
t_Log "SKIP $0: only run on centos stream 8 or greater"
|
|
Carlos Rodriguez-Fernandez |
b716f0 |
exit 0
|
|
Carlos Rodriguez-Fernandez |
b716f0 |
fi
|
|
Carlos Rodriguez-Fernandez |
b716f0 |
|
|
Carlos Rodriguez-Fernandez |
b4312e |
tests_in_order=(
|
|
Carlos Rodriguez-Fernandez |
b4312e |
"podman version"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
"podman info"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
"podman run --rm quay.io/centos/centos:stream${centos_ver} bash -c 'echo HELLO' | grep -q -e 'HELLO'"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
"podman system service -t 1"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
"touch ${HOME}/test.txt && \
|
|
Carlos Rodriguez-Fernandez |
b4312e |
podman run --rm --privileged -v ${HOME}/test.txt:/test.txt quay.io/centos/centos:stream${centos_ver} bash -c 'echo HELLO > /test.txt' && \
|
|
Carlos Rodriguez-Fernandez |
b4312e |
grep -q -e 'HELLO' ${HOME}/test.txt && \
|
|
Carlos Rodriguez-Fernandez |
b4312e |
rm -f ${HOME}/test.txt"
|
|
Carlos Rodriguez-Fernandez |
2ff407 |
"printf \"FROM quay.io/centos/centos:stream${centos_ver}\nCMD echo 'HELLO'\n\" > ${HOME}/Containerfile && \
|
|
Carlos Rodriguez-Fernandez |
4ba762 |
podman build -t test:latest -f ${HOME}/Containerfile && \
|
|
Carlos Rodriguez-Fernandez |
4ba762 |
podman image rm localhost/test:latest && \
|
|
Carlos Rodriguez-Fernandez |
4ba762 |
rm -rf ${HOME}/Containerfile"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
)
|
|
Carlos Rodriguez-Fernandez |
b4312e |
|
|
Carlos Rodriguez-Fernandez |
244d15 |
output_file=$(mktemp)
|
|
Carlos Rodriguez-Fernandez |
244d15 |
trap "rm -f ${output_file}" EXIT
|
|
Carlos Rodriguez-Fernandez |
244d15 |
|
|
Carlos Rodriguez-Fernandez |
b4312e |
for cmd in "${tests_in_order[@]}"; do
|
|
Carlos Rodriguez-Fernandez |
b4312e |
t_Log "Running $0: ${cmd}"
|
|
Carlos Rodriguez-Fernandez |
244d15 |
if ! eval "${cmd}" > ${output_file} 2>&1; then
|
|
Carlos Rodriguez-Fernandez |
b4312e |
t_Log "FAIL: $0: ${cmd}"
|
|
Carlos Rodriguez-Fernandez |
244d15 |
cat ${output_file}
|
|
Carlos Rodriguez-Fernandez |
b4312e |
exit 1
|
|
Carlos Rodriguez-Fernandez |
b4312e |
else
|
|
Carlos Rodriguez-Fernandez |
b4312e |
t_Log "PASS: $0: ${cmd}"
|
|
Carlos Rodriguez-Fernandez |
b4312e |
fi
|
|
Carlos Rodriguez-Fernandez |
b4312e |
done
|
|
Carlos Rodriguez-Fernandez |
244d15 |
|