diff --git a/.github/workflows/centos-stream8-container-on-ubuntu.yml b/.github/workflows/centos-stream8-container-on-ubuntu.yml new file mode 100644 index 0000000..8973e04 --- /dev/null +++ b/.github/workflows/centos-stream8-container-on-ubuntu.yml @@ -0,0 +1,91 @@ +jobs: + test_0: + name: test_0 + runs-on: ubuntu-latest + steps: + - uses: "actions/checkout@v2" + - run: pip install each + - run: ls -x1 tests | grep "^0_" > testlist + - run: docker build --build-arg CONTAINERTEST=1 -f Container-8.test -t centos_stream_8_sigt_f . + - run: "docker run -d --name test8 --privileged --rm -e CONTAINERTEST=1 --volume /sys/fs/cgroup:/sys/fs/cgroup:ro -v `pwd`:/opt centos_stream_8_sigt_f" + - run: each -j 4 --no-stdin testlist "docker exec --privileged -e CONTAINERTEST=1 test8 sh -c 'cd /opt && ./runtests.sh {}'" + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; > failed_tests + - run: cat failed_tests | grep -v "^1" | xargs -i tail {}/out + - run: "! [[ -s failed_tests ]]" + test_pxaa: + name: test_pxaa + runs-on: ubuntu-latest + steps: + - uses: "actions/checkout@v2" + - run: pip install each + - run: ls -x1 tests | grep "^p_" > testlist + - run: split -l45 testlist + - run: docker build --build-arg CONTAINERTEST=1 -f Container-8.test -t centos_stream_8_sigt_f . + - run: "docker run -d --name test8 --privileged --rm -e CONTAINERTEST=1 --volume /sys/fs/cgroup:/sys/fs/cgroup:ro -v `pwd`:/opt centos_stream_8_sigt_f" + - run: each -j 4 --no-stdin xaa "docker exec --privileged -e CONTAINERTEST=1 test8 sh -c 'cd /opt && ./runtests.sh {}'" + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; > failed_tests + - run: cat failed_tests | grep -v "^1" | xargs -i tail {}/out + - run: "! [[ -s failed_tests ]]" + test_pxab: + name: test_pxab + runs-on: ubuntu-latest + steps: + - uses: "actions/checkout@v2" + - run: pip install each + - run: ls -x1 tests | grep "^p_" > testlist + - run: split -l45 testlist + - run: docker build --build-arg CONTAINERTEST=1 -f Container-8.test -t centos_stream_8_sigt_f . + - run: "docker run -d --name test8 --privileged --rm -e CONTAINERTEST=1 --volume /sys/fs/cgroup:/sys/fs/cgroup:ro -v `pwd`:/opt centos_stream_8_sigt_f" + - run: each -j 4 --no-stdin xab "docker exec --privileged -e CONTAINERTEST=1 test8 sh -c 'cd /opt && ./runtests.sh {}'" + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; > failed_tests + - run: cat failed_tests | grep -v "^1" | xargs -i tail {}/out + - run: "! [[ -s failed_tests ]]" + test_pxac: + name: test_pxac + runs-on: ubuntu-latest + steps: + - uses: "actions/checkout@v2" + - run: pip install each + - run: ls -x1 tests | grep "^p_" > testlist + - run: split -l45 testlist + - run: docker build --build-arg CONTAINERTEST=1 -f Container-8.test -t centos_stream_8_sigt_f . + - run: "docker run -d --name test8 --privileged --rm -e CONTAINERTEST=1 --volume /sys/fs/cgroup:/sys/fs/cgroup:ro -v `pwd`:/opt centos_stream_8_sigt_f" + - run: each -j 4 --no-stdin xac "docker exec --privileged -e CONTAINERTEST=1 test8 sh -c 'cd /opt && ./runtests.sh {}'" + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; > failed_tests + - run: cat failed_tests | grep -v "^1" | xargs -i tail {}/out + - run: "! [[ -s failed_tests ]]" + test_r: + name: test_r + runs-on: ubuntu-latest + steps: + - uses: "actions/checkout@v2" + - run: pip install each + - run: ls -x1 tests | grep "^r_" > testlist + - run: docker build --build-arg CONTAINERTEST=1 -f Container-8.test -t centos_stream_8_sigt_f . + - run: "docker run -d --name test8 --privileged --rm -e CONTAINERTEST=1 --volume /sys/fs/cgroup:/sys/fs/cgroup:ro -v `pwd`:/opt centos_stream_8_sigt_f" + - run: each -j 4 --no-stdin testlist "docker exec --privileged -e CONTAINERTEST=1 test8 sh -c 'cd /opt && ./runtests.sh {}'" + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; > failed_tests + - run: cat failed_tests | grep -v "^1" | xargs -i tail {}/out + - run: "! [[ -s failed_tests ]]" + test_z: + name: test_z + runs-on: ubuntu-latest + steps: + - uses: "actions/checkout@v2" + - run: pip install each + - run: ls -x1 tests | grep "^z_" > testlist + - run: docker build --build-arg CONTAINERTEST=1 -f Container-8.test -t centos_stream_8_sigt_f . + - run: "docker run -d --name test8 --privileged --rm -e CONTAINERTEST=1 --volume /sys/fs/cgroup:/sys/fs/cgroup:ro -v `pwd`:/opt centos_stream_8_sigt_f" + - run: each -j 4 --no-stdin testlist "docker exec --privileged -e CONTAINERTEST=1 test8 sh -c 'cd /opt && ./runtests.sh {}'" + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; + - run: find . -type f -name "status" -exec grep '1' "{}" \; -exec dirname "{}" \; > failed_tests + - run: cat failed_tests | grep -v "^1" | xargs -i tail {}/out + - run: "! [[ -s failed_tests ]]" +name: Greeting +on: + push: {} diff --git a/Container-8.test b/Container-8.test new file mode 100644 index 0000000..28f504f --- /dev/null +++ b/Container-8.test @@ -0,0 +1,19 @@ +FROM quay.io/centos/centos:stream8 + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] + +COPY . /tmp/test +WORKDIR /tmp/test +RUN CONTAINERTEST=1 ./runtests.sh 0_common +RUN dnf -y install hostname initscripts iproute net-tools diff --git a/Container-9.test b/Container-9.test new file mode 100644 index 0000000..014cff8 --- /dev/null +++ b/Container-9.test @@ -0,0 +1,19 @@ +FROM quay.io/centos/centos:stream9 + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] + +COPY . /tmp/test +WORKDIR /tmp/test +RUN CONTAINERTEST=1 ./runtests.sh 0_common +RUN dnf -y install hostname initscripts iproute net-tools diff --git a/tests/0_common/00_centos_repos.sh b/tests/0_common/00_centos_repos.sh index f51ea10..a1d3450 100755 --- a/tests/0_common/00_centos_repos.sh +++ b/tests/0_common/00_centos_repos.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "$centos_ver" -eq "8" ]; then +if [ "$centos_ver" -ge "8" ]; then t_Log "python not installed by default on .el8. SKIP" exit 0 else diff --git a/tests/0_common/50_test_comps.sh b/tests/0_common/50_test_comps.sh index 1fb683b..41776f9 100755 --- a/tests/0_common/50_test_comps.sh +++ b/tests/0_common/50_test_comps.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - testing comps.xml groups" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if [ "$centos_ver" -eq "7" ]; then t_Log "CentOS $centos_ver -> SKIP" exit 0 @@ -13,14 +18,13 @@ ALL_GROUPS=`dnf group list -v --hidden | grep '^ ' | sed 's/.*(\(.*\))$/\1/'` for GROUP in $ALL_GROUPS; do t_Log " - testing group $GROUP" - # Pretend to install the group, but all we really want is the solver debug data - dnf --installroot=/tmp group --releasever $centos_ver install --assumeno --debugsolver $GROUP >/dev/null - + dnf --installroot=/tmp group --releasever $centos_ver install --assumeno --debugsolver $GROUP + pwd + ls # Check the solver results to see if there are problems - grep -qw '^problem' debugdata/rpms/solver.result + grep '^problem' debugdata/rpms/solver.result RES=$? - # Clean up the debugdata rm -rf debugdata/ diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh index 270491c..50c000b 100755 --- a/tests/0_lib/functions.sh +++ b/tests/0_lib/functions.sh @@ -22,6 +22,10 @@ function t_CheckExitStatus # Arguments: a space separated list of package names to install. function t_InstallPackage { + if [ "$centos_ver" -ge "8" ]; then + mkdir /var/cache/{dnf,yum,system-upgrade} + dnf makecache + fi t_Log "Attempting yum install: $*" /usr/bin/yum -y -d${YUMDEBUG} install "$@" # TODO: add a hook here, to make sure all binary files have ldd run @@ -70,15 +74,15 @@ function t_ResetModule function t_Process { exec 7< $@ - + while read -u 7 f do # skip files named readme or those that start with an _ [[ "$(basename ${f})" =~ readme|^_ ]] && continue; - + # handy tip: chmod -x to disable individual test scripts. [ -x ${f} ] && ${f} - + done return 0 @@ -90,14 +94,14 @@ function t_Process function t_CheckDeps { # TODO - + # success, all packages are installed return 0 } # Description: perform a service control and sleep for a few seconds to let -# the dust settle. Using this function avoids a race condition wherein -# subsequent tests execute (and typically fail) before a service has had a +# the dust settle. Using this function avoids a race condition wherein +# subsequent tests execute (and typically fail) before a service has had a # chance to fully start/open a network port etc. # Call it with cycle instead of start, and it will stop+start # handy, if you dont know the service might already be running @@ -118,7 +122,7 @@ function t_ServiceControl # Description: Get a package (rpm) release number function t_GetPkgRel { - rpm -q --queryformat '%{RELEASE}' $1 + rpm -q --queryformat '%{RELEASE}' $1 } # Description: return the distro release (returns 5 or 6 now) @@ -180,10 +184,10 @@ function t_SkipReleaseGreaterThan { # Description: Get a package (rpm) version number function t_GetPkgVer { - rpm -q --queryformat '%{version}' $1 + rpm -q --queryformat '%{version}' $1 } -# Description: get the arch +# Description: get the arch function t_GetArch { rpm -q $(rpm -qf /etc/redhat-release) --queryformat '%{arch}\n' @@ -214,7 +218,7 @@ function t_Assert function t_Assert_Equals { - [ $1 -eq $2 ] + [ $1 -eq $2 ] t_CheckExitStatus $? } function t_Select_Alternative diff --git a/tests/p_arpwatch/10_arpwatch_test.sh b/tests/p_arpwatch/10_arpwatch_test.sh index c000beb..29c4693 100755 --- a/tests/p_arpwatch/10_arpwatch_test.sh +++ b/tests/p_arpwatch/10_arpwatch_test.sh @@ -11,6 +11,11 @@ fi t_Log "Running $0 - arpwatch on interface with default gateway" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + # arpwatch is broken in el7 # See https://bugzilla.redhat.com/show_bug.cgi?id=1044062 [[ $centos_ver -eq 7 ]] && { diff --git a/tests/p_audit/1_auditd_running.sh b/tests/p_audit/1_auditd_running.sh index bb050cd..7dbf2ce 100755 --- a/tests/p_audit/1_auditd_running.sh +++ b/tests/p_audit/1_auditd_running.sh @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash # Author: Athmane Madjoudj t_Log "Running $0 - check if auditd is running." -if [ $SKIP_QA_HARNESS -eq 1 ]; then +if [ "$SKIP_QA_HARNESS" -eq 1 ] | [ "$CONTAINERTEST" -eq 1 ] ; then echo "Skipping this test ..." else service auditd status > /dev/null 2>&1 diff --git a/tests/p_audit/2_auditd_generate-events.sh b/tests/p_audit/2_auditd_generate-events.sh index a157cee..e6dd704 100755 --- a/tests/p_audit/2_auditd_generate-events.sh +++ b/tests/p_audit/2_auditd_generate-events.sh @@ -1,9 +1,13 @@ #!/bin/sh # Author: Athmane Madjoudj +if [ $SKIP_QA_HARNESS -eq 1 -o $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else t_Log "Running $0 - Generate some events for audit log." useradd testauditd userdel testauditd t_CheckExitStatus $? +fi diff --git a/tests/p_audit/3_auditd_logging.sh b/tests/p_audit/3_auditd_logging.sh index 0207701..53e4c96 100755 --- a/tests/p_audit/3_auditd_logging.sh +++ b/tests/p_audit/3_auditd_logging.sh @@ -1,8 +1,11 @@ #!/bin/sh # Author: Athmane Madjoudj - +if [ $SKIP_QA_HARNESS -eq 1 -o $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else t_Log "Running $0 - check if audit log is not empty." [[ -s /var/log/audit/audit.log ]] t_CheckExitStatus $? +fi diff --git a/tests/p_autofs/0-install_autofs.sh b/tests/p_autofs/0-install_autofs.sh index 348649e..14a5c24 100755 --- a/tests/p_autofs/0-install_autofs.sh +++ b/tests/p_autofs/0-install_autofs.sh @@ -1,6 +1,10 @@ #!/bin/bash # Author: Christoph Galuschka +if [ $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else + t_Log "Running $0 - Installing required packages" if [ "$centos_ver" = "5" ] ; then @@ -31,3 +35,4 @@ ls -al /mnt | egrep -q '(dnf|yum)' t_CheckExitStatus $? umount /mnt +fi diff --git a/tests/p_autofs/10-autofs-nfs-mount.sh b/tests/p_autofs/10-autofs-nfs-mount.sh index 939a37e..0a402b4 100755 --- a/tests/p_autofs/10-autofs-nfs-mount.sh +++ b/tests/p_autofs/10-autofs-nfs-mount.sh @@ -1,6 +1,8 @@ #!/bin/sh # Author: Christoph Galuschka - +if [ $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else t_Log "Running $0 - autofs can mount nfs share test." t_Log 'Preparing autofs configuration' @@ -23,3 +25,4 @@ t_ServiceControl autofs stop t_ServiceControl nfs stop t_ServiceControl nfs-server stop t_ServiceControl rpcbind stop +fi diff --git a/tests/p_bind/bind_test.sh b/tests/p_bind/bind_test.sh index dac06e7..47c8070 100755 --- a/tests/p_bind/bind_test.sh +++ b/tests/p_bind/bind_test.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - bind: local resolver can qualify 127.0.0.1" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + dig +timeout=1 +short @127.0.0.1 localhost | grep -q '127.0.0.1' t_CheckExitStatus $? diff --git a/tests/p_bridge-utils/05-add_bridge.sh b/tests/p_bridge-utils/05-add_bridge.sh index 21ec278..63ed5ec 100755 --- a/tests/p_bridge-utils/05-add_bridge.sh +++ b/tests/p_bridge-utils/05-add_bridge.sh @@ -1,6 +1,11 @@ #!/bin/bash # Author : Madhurranjan Mohaan +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if [ $# -eq 0 ] then bridge=testbridge1 diff --git a/tests/p_bridge-utils/10-delete_bridge.sh b/tests/p_bridge-utils/10-delete_bridge.sh index 046db4a..65725c9 100755 --- a/tests/p_bridge-utils/10-delete_bridge.sh +++ b/tests/p_bridge-utils/10-delete_bridge.sh @@ -1,6 +1,11 @@ #!/bin/bash # Author : Madhurranjan Mohaan +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + . "$(dirname "$0")"/p_bridge-utils-functions #add bridge bridge=testbridge2 diff --git a/tests/p_coreutils/0-install_coreutils.sh b/tests/p_coreutils/0-install_coreutils.sh index 283b022..dc6a246 100755 --- a/tests/p_coreutils/0-install_coreutils.sh +++ b/tests/p_coreutils/0-install_coreutils.sh @@ -2,4 +2,9 @@ # Author: Alice Kaerast t_Log "$0 - installing coreutils" -t_InstallPackage coreutils + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_InstallPackage coreutils-single +else + t_InstallPackage coreutils +fi \ No newline at end of file diff --git a/tests/p_curl/0-install_curl.sh b/tests/p_curl/0-install_curl.sh index f77ff47..555a439 100755 --- a/tests/p_curl/0-install_curl.sh +++ b/tests/p_curl/0-install_curl.sh @@ -3,4 +3,9 @@ # Christoph Galuschka t_Log "$0 - installing curl" -t_InstallPackage curl +if [ "$centos_ver" -ge "9" ]; then + t_InstallPackage curl-minimal +else + t_InstallPackage curl +fi + diff --git a/tests/p_dovecot/dovecot_imap_login.sh b/tests/p_dovecot/dovecot_imap_login.sh index 949d34c..9586f2c 100755 --- a/tests/p_dovecot/dovecot_imap_login.sh +++ b/tests/p_dovecot/dovecot_imap_login.sh @@ -4,6 +4,11 @@ t_Log "Running $0 - adding imaptest local user account + attempting IMAP login" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + { userdel -rf imaptest; useradd imaptest && echo imaptest | passwd --stdin imaptest; } &>/dev/null # creating maildir in HOME, else test will fail at first try diff --git a/tests/p_dovecot/dovecot_pop3_login.sh b/tests/p_dovecot/dovecot_pop3_login.sh index 0ce53fc..33885ca 100755 --- a/tests/p_dovecot/dovecot_pop3_login.sh +++ b/tests/p_dovecot/dovecot_pop3_login.sh @@ -4,6 +4,11 @@ t_Log "Running $0 - adding pop3test local user account + attempting POP3 login" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + { userdel -rf pop3test; useradd pop3test && echo pop3test | passwd --stdin pop3test; } &>/dev/null # creating maildir in HOME, else test will fail at first try diff --git a/tests/p_file/00_file_package.sh b/tests/p_file/00_file_package.sh index 402649c..42058cd 100755 --- a/tests/p_file/00_file_package.sh +++ b/tests/p_file/00_file_package.sh @@ -2,4 +2,6 @@ t_Log "Running $0 - checking if file package is installed" +t_InstallPackage file + t_Assert "rpm -q file" diff --git a/tests/p_freeradius/10_radiusd_test.sh b/tests/p_freeradius/10_radiusd_test.sh index 9edb1c0..1db4cae 100755 --- a/tests/p_freeradius/10_radiusd_test.sh +++ b/tests/p_freeradius/10_radiusd_test.sh @@ -2,6 +2,11 @@ # Author: Christoph Galuschka # Athmane Madjodj +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if (t_GetPkgRel basesystem | grep -q el9) then t_Log "This is a C9 system. Freeradius doesn't work. FIX LATER. Skipping." diff --git a/tests/p_httpd/0-install_httpd.sh b/tests/p_httpd/0-install_httpd.sh index 3e33481..9e3b997 100755 --- a/tests/p_httpd/0-install_httpd.sh +++ b/tests/p_httpd/0-install_httpd.sh @@ -8,13 +8,19 @@ then php_mysql="php-mysqlnd" fi +curl="curl" +if [ $centos_ver -ge 8 ] & [ "$CONTAINERTEST" -eq "1" ] +then + curl="curl" +fi + # Install tests deps -t_Log "Running $0 - httpd: installing curl, http, php and $php_mysql" +t_Log "Running $0 - httpd: installing $curl, http, php and $php_mysql" #t_InstallPackage curl # HTTPD / PHP -t_InstallPackage curl httpd mod_ssl php $php_mysql +t_InstallPackage $curl httpd mod_ssl php $php_mysql t_ServiceControl httpd stop sleep 3 killall httpd diff --git a/tests/p_initscripts/initscripts_service_status.sh b/tests/p_initscripts/initscripts_service_status.sh index 58bbdd4..e930a40 100755 --- a/tests/p_initscripts/initscripts_service_status.sh +++ b/tests/p_initscripts/initscripts_service_status.sh @@ -1,6 +1,11 @@ #!/bin/bash # Author: Athmane Madjoudj +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - check if service cmd can get service status" # auditd is used as example because it's standard with minimal install diff --git a/tests/p_iptraf/0-install_iptraf.sh b/tests/p_iptraf/0-install_iptraf.sh index b4f30f4..2dc5418 100755 --- a/tests/p_iptraf/0-install_iptraf.sh +++ b/tests/p_iptraf/0-install_iptraf.sh @@ -1,6 +1,11 @@ #!/bin/bash # Author: Steve Barnes (steve@echo.id.au) +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - iptraf: install iptraf and which" # IPTraf traffic monitoring package diff --git a/tests/p_iptraf/5-test_iptraf.sh b/tests/p_iptraf/5-test_iptraf.sh index 8697c4f..f3f8228 100755 --- a/tests/p_iptraf/5-test_iptraf.sh +++ b/tests/p_iptraf/5-test_iptraf.sh @@ -1,6 +1,11 @@ #!/bin/bash # Author: Steve Barnes (steve@echo.id.au) +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - checking iptraf runs and returns non-zero exit status." TMP=/tmp/iptraf.log diff --git a/tests/p_lftp/10_lftp_http_test.sh b/tests/p_lftp/10_lftp_http_test.sh index ac93251..a049895 100755 --- a/tests/p_lftp/10_lftp_http_test.sh +++ b/tests/p_lftp/10_lftp_http_test.sh @@ -7,6 +7,11 @@ t_Log "Running $0 - lftp: HTTP test" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if [ $SKIP_QA_HARNESS -eq 1 ]; then URL="http://mirror.centos.org/" else diff --git a/tests/p_lftp/20_lftp_ftp.sh b/tests/p_lftp/20_lftp_ftp.sh index 0fe0186..ae99d9f 100755 --- a/tests/p_lftp/20_lftp_ftp.sh +++ b/tests/p_lftp/20_lftp_ftp.sh @@ -7,6 +7,12 @@ t_Log "Running $0 - installing vsFTPd for local lftp test." t_InstallPackage vsftpd + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if [ "$centos_ver" -ge 8 ] ; then cp -fp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.tf_p_lftp sed -i 's/anonymous_enable=NO/anonymous_enable=YES/g' /etc/vsftpd/vsftpd.conf diff --git a/tests/p_libvirt/0-install_libvirt.sh b/tests/p_libvirt/0-install_libvirt.sh index c9f5939..7ef9db4 100755 --- a/tests/p_libvirt/0-install_libvirt.sh +++ b/tests/p_libvirt/0-install_libvirt.sh @@ -1,5 +1,11 @@ #!/bin/bash # Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if (t_GetArch | grep -qE 'aarch64') then echo "Package not included with AArch64, skipping" diff --git a/tests/p_libvirt/libvirt_virsh_test.sh b/tests/p_libvirt/libvirt_virsh_test.sh index 229ac6e..c9541dc 100755 --- a/tests/p_libvirt/libvirt_virsh_test.sh +++ b/tests/p_libvirt/libvirt_virsh_test.sh @@ -1,5 +1,11 @@ #!/bin/sh # Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if (t_GetArch | grep -qE 'aarch64') then echo "Package not included with AArch64, skipping" diff --git a/tests/p_logwatch/logwatch_test.sh b/tests/p_logwatch/logwatch_test.sh index 333887a..8370ea0 100755 --- a/tests/p_logwatch/logwatch_test.sh +++ b/tests/p_logwatch/logwatch_test.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - logwatch test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if [ "$centos_ver" -ge 7 ] ; then lw_options="--range Today" else diff --git a/tests/p_lsof/10-test_lsof.sh b/tests/p_lsof/10-test_lsof.sh index c881eb7..c6dc5cc 100755 --- a/tests/p_lsof/10-test_lsof.sh +++ b/tests/p_lsof/10-test_lsof.sh @@ -4,6 +4,11 @@ t_Log "Running $0 - testing lsof against ssh port" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + sshd_status=`service sshd status | grep running` if ! [ "$sshd_status" ] then diff --git a/tests/p_lynx/0-install_lynx.sh b/tests/p_lynx/0-install_lynx.sh index 62f875e..5abad2f 100755 --- a/tests/p_lynx/0-install_lynx.sh +++ b/tests/p_lynx/0-install_lynx.sh @@ -3,7 +3,7 @@ t_Log "$0 - installing Lynx" -if [ "$centos_ver" -eq "8" ]; then +if [ "$centos_ver" -ge "8" ]; then t_Log "Package lynx not available in default repos on c8 => SKIP" exit 0 fi diff --git a/tests/p_lynx/lynx_default_page_centos_test.sh b/tests/p_lynx/lynx_default_page_centos_test.sh index 4547e57..18be902 100755 --- a/tests/p_lynx/lynx_default_page_centos_test.sh +++ b/tests/p_lynx/lynx_default_page_centos_test.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - check that lynx default page is CentOS welcome page ." -if [ "$centos_ver" -eq "8" ]; then +if [ "$centos_ver" -ge "8" ]; then t_Log "Package lynx not available in default repos on c8 => SKIP" exit 0 fi diff --git a/tests/p_lynx/lynx_dump_page_test.sh b/tests/p_lynx/lynx_dump_page_test.sh index ade5dad..97f02c4 100755 --- a/tests/p_lynx/lynx_dump_page_test.sh +++ b/tests/p_lynx/lynx_dump_page_test.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - check that lynx can dump remote page." -if [ "$centos_ver" -eq "8" ]; then +if [ "$centos_ver" -ge "8" ]; then t_Log "Package lynx not available in default repos on c8 => SKIP" exit 0 fi diff --git a/tests/p_mailman/0-install_mailman.sh b/tests/p_mailman/0-install_mailman.sh index cbd4caf..71355e5 100755 --- a/tests/p_mailman/0-install_mailman.sh +++ b/tests/p_mailman/0-install_mailman.sh @@ -1,5 +1,11 @@ #!/bin/bash # Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if (t_GetPkgRel basesystem | grep -q el9) then t_Log "This is a C9 system. mailman not present. Skipping." diff --git a/tests/p_mailman/mailman_test.sh b/tests/p_mailman/mailman_test.sh index 24c832f..18eef26 100755 --- a/tests/p_mailman/mailman_test.sh +++ b/tests/p_mailman/mailman_test.sh @@ -1,6 +1,11 @@ #!/bin/sh # Author: Athmane Madjoudj +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if (t_GetPkgRel basesystem | grep -q el9) then t_Log "This is a C9 system. mailman not present. Skipping." diff --git a/tests/p_mtr/mtr_test.sh b/tests/p_mtr/mtr_test.sh index 36a76f2..79a633c 100755 --- a/tests/p_mtr/mtr_test.sh +++ b/tests/p_mtr/mtr_test.sh @@ -1,6 +1,11 @@ #!/bin/sh # Author: Christoph Galuschka +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + TEST=mtr # Testing availability of network diff --git a/tests/p_mysql/10_mysqld_conn_test.sh b/tests/p_mysql/10_mysqld_conn_test.sh index edf5d73..a30642d 100755 --- a/tests/p_mysql/10_mysqld_conn_test.sh +++ b/tests/p_mysql/10_mysqld_conn_test.sh @@ -8,7 +8,7 @@ MySqlHostName=$(mysql -N -B -u root -e "show variables like 'hostname'" | cut -f # printing both variables for debugging purposes echo $HostName echo ${MySqlHostName} -if [ $HostName = ${MySqlHostName} ]; then +if [ "$HostName" = "${MySqlHostName}" ]; then ret_val=0 else ret_val=1 diff --git a/tests/p_network/networking_vlan_test.sh b/tests/p_network/networking_vlan_test.sh index 9a6f655..6f0fe1c 100755 --- a/tests/p_network/networking_vlan_test.sh +++ b/tests/p_network/networking_vlan_test.sh @@ -1,6 +1,11 @@ #!/bin/sh # Author: Christoph Galuschka +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - create VLAN IF, assign IP on VLAN IF and tear down VLAN IF using IP command test (not on C5)" ret_val=0 diff --git a/tests/p_nfs/nfs_share_rw.sh b/tests/p_nfs/nfs_share_rw.sh index d75c434..c9fb535 100755 --- a/tests/p_nfs/nfs_share_rw.sh +++ b/tests/p_nfs/nfs_share_rw.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - NFS writable share test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + cp /etc/exports /etc/exports.orig echo '/srv/nfs *(rw,sync,no_root_squash)' >/etc/exports mkdir -p /srv/nfs diff --git a/tests/p_nmap/nmap_test_eth0.sh b/tests/p_nmap/nmap_test_eth0.sh index df24b90..74c01a0 100755 --- a/tests/p_nmap/nmap_test_eth0.sh +++ b/tests/p_nmap/nmap_test_eth0.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - nmap querys eth0 and checks for open ssh-port" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + # Grabing IP of eth0 IP=$(ip -f inet addr list eth0 | grep 'inet ') regex='.*inet\ (.*)\/.*' diff --git a/tests/p_nmap/nmap_test_lo.sh b/tests/p_nmap/nmap_test_lo.sh index 692973d..6e8de22 100755 --- a/tests/p_nmap/nmap_test_lo.sh +++ b/tests/p_nmap/nmap_test_lo.sh @@ -1,6 +1,11 @@ #!/bin/sh # Author: Christoph Galuschka +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - nmap querys loopback and checks for open ssh port" nmap 127.0.0.1 | grep -qi ssh diff --git a/tests/p_openssh/sshd_user_login-with-key.sh b/tests/p_openssh/sshd_user_login-with-key.sh index d3e7887..f8d41e0 100755 --- a/tests/p_openssh/sshd_user_login-with-key.sh +++ b/tests/p_openssh/sshd_user_login-with-key.sh @@ -1,5 +1,10 @@ #!/bin/sh +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + keytypes="rsa" if [ "$centos_ver" -lt 8 ] ; then keytypes="$keytypes dsa" diff --git a/tests/p_openssh/sshd_user_login.sh b/tests/p_openssh/sshd_user_login.sh index 78b64bb..6c0d373 100755 --- a/tests/p_openssh/sshd_user_login.sh +++ b/tests/p_openssh/sshd_user_login.sh @@ -8,6 +8,11 @@ touch /home/sshtest/ssh_test_file t_Log "Running $0 - SSH Interactive user login test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + if [ `egrep "^PasswordAuthentication" /etc/ssh/sshd_config | tail -n1 | egrep "\syes$" | wc -l ` -gt 0 ]; then ./tests/p_openssh/_helper_sshd_user_login.expect | grep "ssh_test_file" > /dev/null 2>&1 t_CheckExitStatus $? diff --git a/tests/p_postfix/10_postfix_smtp.sh b/tests/p_postfix/10_postfix_smtp.sh index b55fc9a..c1a01fd 100755 --- a/tests/p_postfix/10_postfix_smtp.sh +++ b/tests/p_postfix/10_postfix_smtp.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - Postfix SMTP test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + echo "helo test" | nc -w 3 127.0.0.1 25 | grep -q '250' t_CheckExitStatus $? diff --git a/tests/p_postfix/20_postfix_mta.sh b/tests/p_postfix/20_postfix_mta.sh index 303f452..3b134aa 100755 --- a/tests/p_postfix/20_postfix_mta.sh +++ b/tests/p_postfix/20_postfix_mta.sh @@ -2,6 +2,12 @@ # Author: Christoph Galuschka t_Log "Running $0 - postfix can accept and deliver local email." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + ret_val=1 # send mail to localhost diff --git a/tests/p_postfix/30_postfix_mta_ehlo.sh b/tests/p_postfix/30_postfix_mta_ehlo.sh index 6158bc9..b0fa446 100755 --- a/tests/p_postfix/30_postfix_mta_ehlo.sh +++ b/tests/p_postfix/30_postfix_mta_ehlo.sh @@ -2,6 +2,10 @@ # Author: Christoph Galuschka t_Log "Running $0 - postfix can accept and deliver local email using ESMTP." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi ret_val=1 # send mail to localhost diff --git a/tests/p_postfix/40_postfix_sasl.sh b/tests/p_postfix/40_postfix_sasl.sh index 4283754..568e147 100755 --- a/tests/p_postfix/40_postfix_sasl.sh +++ b/tests/p_postfix/40_postfix_sasl.sh @@ -2,6 +2,10 @@ # Author: Christoph Galuschka t_Log "Running $0 - Postfix plain SASL test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi t_Log "Installing prerequisits" t_InstallPackage dovecot diff --git a/tests/p_postfix/50_postfix_tls.sh b/tests/p_postfix/50_postfix_tls.sh index 876226f..162325c 100755 --- a/tests/p_postfix/50_postfix_tls.sh +++ b/tests/p_postfix/50_postfix_tls.sh @@ -2,6 +2,10 @@ # Author: Christoph Galuschka t_Log "Running $0 - Postfix plain SASL test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi t_Log "Installing prerequisits" t_InstallPackage openssl diff --git a/tests/p_python-iniparse/0-install-python-iniparse.sh b/tests/p_python-iniparse/0-install-python-iniparse.sh index 789b391..860bd44 100755 --- a/tests/p_python-iniparse/0-install-python-iniparse.sh +++ b/tests/p_python-iniparse/0-install-python-iniparse.sh @@ -5,7 +5,7 @@ t_Log "Running $0 - installing python-iniparse." if [ "$centos_ver" -ge 8 ] ; then -t_InstallPackage python3-iniparse +t_InstallPackage python3 python3-iniparse else t_InstallPackage python-iniparse fi diff --git a/tests/p_samba/0-install_samba.sh b/tests/p_samba/0-install_samba.sh index 3174802..16f6081 100755 --- a/tests/p_samba/0-install_samba.sh +++ b/tests/p_samba/0-install_samba.sh @@ -1,6 +1,11 @@ #!/bin/bash # Author: Athmane Madjoudj +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_InstallPackage samba samba-client cifs-utils t_ServiceControl smb start diff --git a/tests/p_samba/samba_share_test.sh b/tests/p_samba/samba_share_test.sh index 262bb76..f2e6f86 100755 --- a/tests/p_samba/samba_share_test.sh +++ b/tests/p_samba/samba_share_test.sh @@ -1,6 +1,11 @@ #!/bin/sh # Author: Athmane Madjoudj +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - Samba share test." cp /etc/samba/smb.conf /etc/samba/smb.conf.orig diff --git a/tests/p_selinux/selinux_alerts.sh b/tests/p_selinux/selinux_alerts.sh index 0df9130..de2c0ce 100755 --- a/tests/p_selinux/selinux_alerts.sh +++ b/tests/p_selinux/selinux_alerts.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - check for SELinux alerts (AVC)" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + grep -v "AVC" /var/log/audit/audit.log > /dev/null 2>&1 t_CheckExitStatus $? diff --git a/tests/p_selinux/selinux_policy_mismatch.sh b/tests/p_selinux/selinux_policy_mismatch.sh index b6f0af2..1375308 100755 --- a/tests/p_selinux/selinux_policy_mismatch.sh +++ b/tests/p_selinux/selinux_policy_mismatch.sh @@ -8,6 +8,12 @@ fi t_Log "Running $0 - Testing audit2why for policy mismatch ..." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + cat << __EOF__ | $PYTHON - import sys import selinux.audit2why as audit2why diff --git a/tests/p_sendmail/10_sendmail_smtp.sh b/tests/p_sendmail/10_sendmail_smtp.sh index 7ec11dd..651124d 100755 --- a/tests/p_sendmail/10_sendmail_smtp.sh +++ b/tests/p_sendmail/10_sendmail_smtp.sh @@ -1,6 +1,11 @@ #!/bin/sh # Author: Athmane Madjoudj +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + t_Log "Running $0 - Sendmail SMTP test." echo "helo test" | nc -4 -w 3 localhost 25 | grep -q '250' diff --git a/tests/p_sendmail/20_sendmail_mta.sh b/tests/p_sendmail/20_sendmail_mta.sh index a29153f..2e24960 100755 --- a/tests/p_sendmail/20_sendmail_mta.sh +++ b/tests/p_sendmail/20_sendmail_mta.sh @@ -2,6 +2,10 @@ # Author: Christoph Galuschka t_Log "Running $0 - sendmail can accept and deliver local email." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi ret_val=1 # send mail to localhost diff --git a/tests/p_sendmail/30_sendmail_mta_ehlo.sh b/tests/p_sendmail/30_sendmail_mta_ehlo.sh index 4bc1832..bd5b309 100755 --- a/tests/p_sendmail/30_sendmail_mta_ehlo.sh +++ b/tests/p_sendmail/30_sendmail_mta_ehlo.sh @@ -2,6 +2,10 @@ # Author: Christoph Galuschka t_Log "Running $0 - sendmail can accept and deliver local email." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi ret_val=1 # send mail to localhost diff --git a/tests/p_shadow-utils/11-useradd_tests b/tests/p_shadow-utils/11-useradd_tests index 12206c6..10f8fd8 100755 --- a/tests/p_shadow-utils/11-useradd_tests +++ b/tests/p_shadow-utils/11-useradd_tests @@ -3,10 +3,12 @@ t_Log "Running $0" +grep -q "^shadowuser" /etc/passwd && userdel -r shadowuser + # Basic useradd tests echo "Add user shadowuser" useradd shadowuser t_CheckExitStatus $? echo "Check user was created" grep -q "^shadowuser" /etc/passwd -t_CheckExitStatus $? +t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_shadow-utils/12-usermod_tests b/tests/p_shadow-utils/12-usermod_tests index 49c6279..17a86c5 100755 --- a/tests/p_shadow-utils/12-usermod_tests +++ b/tests/p_shadow-utils/12-usermod_tests @@ -2,6 +2,7 @@ # Author: Iain Douglas t_Log "Running $0 - Modify user shadowuser" + usermod -c "Comment plugh" shadowuser t_CheckExitStatus $? echo "Check /etc/passwd was modified" diff --git a/tests/p_shadow-utils/14-newusers_tests b/tests/p_shadow-utils/14-newusers_tests index d65925f..c30a03a 100755 --- a/tests/p_shadow-utils/14-newusers_tests +++ b/tests/p_shadow-utils/14-newusers_tests @@ -2,6 +2,12 @@ # Author: Iain Douglas t_Log "Running $0 - Testing newusers" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + grep -q "^xyssy" /etc/passwd && { t_Log "FAIL: user xyssy alredy exists"; exit $FAIL; } newusers < SKIP" + exit 0 +fi + t_Log "Running $0 - checking strace runs and returns non-zero exit status." STRACE=`which strace` diff --git a/tests/p_systemd/10-systemctl_list_services.sh b/tests/p_systemd/10-systemctl_list_services.sh index 1e2b3d5..35c4359 100755 --- a/tests/p_systemd/10-systemctl_list_services.sh +++ b/tests/p_systemd/10-systemctl_list_services.sh @@ -3,6 +3,12 @@ # Rene Diepstraten t_Log "Running $0 - Checking if systemctl can check if a service is enabled" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + [ ${centos_ver} -lt 7 ] && { t_Log "Systemd is part of el since el7, skipping systemd tests..." ; exit ; } # auditd is used as example because it's standard with minimal install diff --git a/tests/p_systemd/15-systemctl_list_non-native-services.sh b/tests/p_systemd/15-systemctl_list_non-native-services.sh index e75d4c3..2656aa1 100755 --- a/tests/p_systemd/15-systemctl_list_non-native-services.sh +++ b/tests/p_systemd/15-systemctl_list_non-native-services.sh @@ -2,6 +2,11 @@ # Author: Athmane Madjoudj # Rene Diepstraten +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + [ ${centos_ver} -lt 7 ] && exit t_Log "Running $0 - Checking if systemctl can check if a non-native service is enabled" diff --git a/tests/p_systemd/20-systemctl_list-service-status.sh b/tests/p_systemd/20-systemctl_list-service-status.sh index ecd2bee..7a5ac70 100755 --- a/tests/p_systemd/20-systemctl_list-service-status.sh +++ b/tests/p_systemd/20-systemctl_list-service-status.sh @@ -4,6 +4,11 @@ [ ${centos_ver} -lt 7 ] && exit t_Log "Running $0 - checking if systemctl can check a service status" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + systemctl is-active auditd.service > /dev/null t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_systemd/25-journalctl.sh b/tests/p_systemd/25-journalctl.sh index e43631b..ea44a3d 100755 --- a/tests/p_systemd/25-journalctl.sh +++ b/tests/p_systemd/25-journalctl.sh @@ -4,6 +4,11 @@ [ ${centos_ver} -lt 7 ] && exit t_Log "Running $0 - Testing journalctl for teststring" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + teststring=098f6bcd4621d373cade4e832627b4f6 timenow=$(date +'%T') echo ${teststring} > /dev/kmsg diff --git a/tests/p_tcpdump/02_tcpdump_lo.sh b/tests/p_tcpdump/02_tcpdump_lo.sh index f606e11..4be9aad 100755 --- a/tests/p_tcpdump/02_tcpdump_lo.sh +++ b/tests/p_tcpdump/02_tcpdump_lo.sh @@ -4,6 +4,12 @@ t_Log "Running $0 - TCPdump test to lo" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + #Dumping pings to loopback to file FILE='/var/tmp/lo_test.pcap' COUNT='4' diff --git a/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh b/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh index d533fbf..6114c7c 100755 --- a/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh +++ b/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh @@ -4,6 +4,11 @@ t_Log "Running $0 - TCPdump test IPv6 to lo" +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + # Grabing IPv6 address of lo to check if IPv6 is enabled IP=$(ip addr list lo | grep 'inet6 ') regex='\t*inet6\ (.*)\/.*' diff --git a/tests/p_vsftpd/vsftpd_anonymous_login.sh b/tests/p_vsftpd/vsftpd_anonymous_login.sh index 0a04a6f..54ed7a4 100755 --- a/tests/p_vsftpd/vsftpd_anonymous_login.sh +++ b/tests/p_vsftpd/vsftpd_anonymous_login.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - vsFTPd anonymous can login test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + echo -e "user anonymous\npass password\nquit" | nc localhost 21 | grep -q "230 Login successful." t_CheckExitStatus $? diff --git a/tests/p_vsftpd/vsftpd_localusers_login.sh b/tests/p_vsftpd/vsftpd_localusers_login.sh index ca122c8..9e33ed4 100755 --- a/tests/p_vsftpd/vsftpd_localusers_login.sh +++ b/tests/p_vsftpd/vsftpd_localusers_login.sh @@ -3,6 +3,11 @@ t_Log "Running $0 - vsFTPd local user can login test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + # Add a test ftp user { userdel -rf ftptest; useradd ftptest && echo ftptest | passwd --stdin ftptest; } &>/dev/null