Update 'tests/sanity' to include more containers

Sanity testcase generates SELinux policy just for one container
"fedora:latest". Testcase should test generating SELinux policy also for
Fedora Rawhide container, RHEL universal base image {7,8} and centos containers
This commit is contained in:
Lukas Vrabec 2020-04-27 12:08:35 +02:00 committed by Vit Mojzis
parent aa4e7af453
commit 41b007ecf3

View File

@ -30,6 +30,8 @@
PACKAGE="udica"
CONTAINERS="fedora:latest fedora:rawhide ubi8 ubi7 centos:8 centos:7"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm "udica"
@ -43,15 +45,16 @@ rlJournalStart
rlRun "PAGER=cat man udica"
rlPhaseEnd
rlPhaseStartTest "Test basic scenario"
rlRun "podman run -dit --name test -v /home:/home:ro -v /var/spool:/var/spool:rw -p 21:21 fedora"
for CONTAINER_NAME in ${CONTAINERS} ; do
rlPhaseStartTest "Test basic scenario for ${CONTAINER_NAME} container"
rlRun "podman run -dit --name test -v /home:/home:ro -v /var/spool:/var/spool:rw -p 21:21 ${CONTAINER_NAME}"
rlRun "podman ps | grep test"
rlRun "ps -efZ | grep bash"
rlRun "ps -efZ | grep bash | grep container_t"
rlRun "podman exec test ls /home" 1,2
rlRun "podman exec test touch /var/spool/test" 1
rlRun "podman exec test dnf install nmap-ncat -y" 0
rlRun "podman exec test yum install nmap-ncat -y" 0
rlWatchdog "rlRun \"podman exec test nc -l 53\"" 3
CONT_ID=$(podman ps | grep test | cut -d ' ' -f 1)
@ -72,7 +75,7 @@ rlJournalStart
rlRun "podman exec test2 ls /home" 0
rlRun "podman exec test2 touch /var/spool/test" 0
rlRun "podman exec test2 dnf install nmap-ncat -y" 0
rlRun "podman exec test2 yum install nmap-ncat -y" 0
rlWatchdog "rlRun \"podman exec test2 nc -l 53\" 2" 3
rlRun "podman stop test2"
@ -81,6 +84,7 @@ rlJournalStart
rlRun "semodule -r my_container base_container net_container home_container"
rlRun "rm my_container.cil"
rlPhaseEnd
done
rlPhaseStartTest "Compare different ways of obtaining policy"
rlRun "podman run -dit --name test -v /home:/home:ro -v /var/spool:/var/spool:rw -p 21:21 fedora"