From dfaa8a804e0b500752e6ab6f6fb1ee73024d494e Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: May 22 2014 10:38:47 +0000 Subject: Merge branch 'master' of gitorious.org:testautomation/t_functional --- diff --git a/tests/0_common/10_remove_32bitpkgs.sh b/tests/0_common/10_remove_32bitpkgs.sh old mode 100755 new mode 100644 diff --git a/tests/0_common/40_update_hosts.sh b/tests/0_common/40_update_hosts.sh index ad952b7..1e0bdfc 100755 --- a/tests/0_common/40_update_hosts.sh +++ b/tests/0_common/40_update_hosts.sh @@ -4,5 +4,5 @@ t_Log "Running $0 - Update /etc/hosts" -echo "127.0.0.1 `hostname` localhost.localdomain" >> /etc/hosts +echo "127.0.0.1 `hostname`" >> /etc/hosts diff --git a/tests/p_amanda/0-install_amanda.sh b/tests/p_amanda/0-install_amanda.sh index 409ade2..ccb0fb6 100755 --- a/tests/p_amanda/0-install_amanda.sh +++ b/tests/p_amanda/0-install_amanda.sh @@ -1,6 +1,14 @@ #!/bin/bash # Author: Athmane Madjoudj -# Christoph Galuschka +# Christoph Galuschka t_Log "$0 - installing amanda system" + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_Log "This is a C5 system. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + t_InstallPackage amanda amanda-server amanda-client diff --git a/tests/p_anaconda/anaconda_centos_patch.sh b/tests/p_anaconda/anaconda_centos_patch.sh index 338878f..06dc6c5 100755 --- a/tests/p_anaconda/anaconda_centos_patch.sh +++ b/tests/p_anaconda/anaconda_centos_patch.sh @@ -3,7 +3,11 @@ t_Log "Running $0 - CentOS Anaconda patch is applied test." -ANACONDA_PATH=/usr/lib/anaconda/ +if [ "$centos_ver" = "7" ];then + ANACONDA_PATH=/usr/lib64/python2.7/site-packages/pyanaconda/ +else + ANACONDA_PATH=/usr/lib/anaconda/ +fi (grep "id = \"centos\"" $ANACONDA_PATH/installclasses/rhel.py >/dev/null 2>&1) &&\ diff --git a/tests/p_diffutils/20-diff-tests b/tests/p_diffutils/20-diff-tests index eaf6993..aba4f8e 100755 --- a/tests/p_diffutils/20-diff-tests +++ b/tests/p_diffutils/20-diff-tests @@ -340,8 +340,12 @@ mv "$DIRTEST"/a/lao "$DIRTEST"/a/LAO echo "Checking --ignore-file-name-case" echo "see https://bugzilla.redhat.com/show_bug.cgi?id=719001" echo "If this fails then the bug has been fixed" -diff --ignore-file-name-case "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_case -t_CheckExitStatus $? +if [ "$centos_ver" = "7" ];then + echo SKIP +else + diff --ignore-file-name-case "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_case + t_CheckExitStatus $? +fi # Check the --to-file option echo "Checking the --to-file option against a file" diff --git a/tests/p_dovecot/dovecot_imap_login.sh b/tests/p_dovecot/dovecot_imap_login.sh index 7c88962..b486eca 100755 --- a/tests/p_dovecot/dovecot_imap_login.sh +++ b/tests/p_dovecot/dovecot_imap_login.sh @@ -13,19 +13,17 @@ chown -R imaptest:imaptest /home/imaptest/mail ret_val=1 t_Log "Dovecot IMAP login test" -# after a restart of dovecot this always results with -# 'imap-login: Disconnected (no auth attempts)' in /var/log/maillog -# first try will be ignored -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." -# and we need some time between login attempts -sleep 3 +# EL7 comes with nmap-nc , different from nc so different options to use -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." -# let's see if a third iteration reduces flakyness of the test -sleep 3 +if [ "$centos_ver" = "7" ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + +echo -e "01 LOGIN imaptest imaptest\n" | nc ${nc_options} localhost 143 | grep -q "Logged in." -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." ret_val=$? if [ $ret_val != 0 ] diff --git a/tests/p_dovecot/dovecot_pop3_login.sh b/tests/p_dovecot/dovecot_pop3_login.sh index 4ac3320..a12056e 100755 --- a/tests/p_dovecot/dovecot_pop3_login.sh +++ b/tests/p_dovecot/dovecot_pop3_login.sh @@ -11,7 +11,16 @@ mkdir -m 700 -p /home/pop3test/mail/.imap/INBOX chown -R pop3test:pop3test /home/pop3test/mail/.imap/INBOX t_Log "Dovecot POP3 login test" -echo -e "user pop3test\npass pop3test\n" | nc -w 5 localhost 110 | grep -q "+OK Logged in." +# EL7 comes with nmap-nc , different from nc so different options to use + +if [ "$centos_ver" = "7" ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + + +echo -e "user pop3test\npass pop3test\n" | nc ${nc_options} localhost 110 | grep -q "+OK Logged in." t_CheckExitStatus $? diff --git a/tests/p_grub/grub_dir_layout_test.sh b/tests/p_grub/grub_dir_layout_test.sh index a4ba86c..f968d8a 100755 --- a/tests/p_grub/grub_dir_layout_test.sh +++ b/tests/p_grub/grub_dir_layout_test.sh @@ -5,6 +5,13 @@ t_Log "Running $0 - check that grub file layout is the same with upstream." +if [ "$centos_ver" = "7" ] ; then + t_Log "el7 comes with grub2, skipping grub test ..." + t_CheckExitStatus 0 + exit 0 +fi + + ARCH=`uname -m | sed 's/i6/i3/'` [[ $( ls /usr/share/grub/ | wc -l ) -eq 1 ]] && \ diff --git a/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh b/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh index 090a7b1..8b13d35 100755 --- a/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh +++ b/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh @@ -3,12 +3,11 @@ t_Log "Running $0 - initscripts CentOS branding " -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log "Test not required for CentOS 6.x" - exit 0 +if [ "$centos_ver" -gt "5" ] ; then + t_Log "Test not required for CentOS $centos_ver -> SKIP" + exit 0 else - grep "CentOS" /etc/rc.sysinit > /dev/null 2>&1 + grep "CentOS" /etc/rc.sysinit > /dev/null 2>&1 fi t_CheckExitStatus $? diff --git a/tests/p_initscripts/initscripts_service_status.sh b/tests/p_initscripts/initscripts_service_status.sh index 2c7c382..58bbdd4 100755 --- a/tests/p_initscripts/initscripts_service_status.sh +++ b/tests/p_initscripts/initscripts_service_status.sh @@ -4,7 +4,7 @@ t_Log "Running $0 - check if service cmd can get service status" # auditd is used as example because it's standard with minimal install -service auditd status | grep -q 'is running' +service auditd status t_CheckExitStatus $? diff --git a/tests/p_ipa-server/0-preclean.sh b/tests/p_ipa-server/0-preclean.sh new file mode 100755 index 0000000..2bfca66 --- /dev/null +++ b/tests/p_ipa-server/0-preclean.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') + then + + t_Log "Running $0 - Stopping and removing httpd if present" + if /sbin/service httpd status 2>&1 | grep 'running...' &> /dev/null + then + /sbin/service httpd stop &> /dev/null + fi + if rpm -q httpd &> /dev/null + then + /usr/bin/yum -y remove httpd &> /dev/null + rm -rf /etc/httpd + fi + + t_Log "Running $0 - Stopping and removing bind if present" + if /sbin/service named status 2>&1 | grep 'running...' &> /dev/null + then + /sbin/service named stop &> /dev/null + fi + if rpm -q bind &> /dev/null + then + /usr/bin/yum -y remove bind &> /dev/null + rm -rf /etc/named /var/named + fi + + + t_Log "Running $0 - Backing up resolv.conf" + cp /etc/resolv.conf /tmp/resolv.conf.ipa-tests + + t_Log "Running $0 - Backing up nsswitch.conf" + cp /etc/nsswitch.conf /tmp/nsswitch.conf.ipa-tests + + t_Log "Running $0 - Backing up hosts file" + cp /etc/hosts /tmp/hosts.ipa-tests + + t_Log "Running $0 - Saving current hostname" + echo $(hostname) >/tmp/hostname.ipa-tests + + if [[ -f /etc/ntp.conf ]] + then + t_Log "Running $0 - Backing up ntp.conf file" + cp /etc/ntp.conf /tmp/ntp.conf.ipa-tests + fi + + t_Log "Running $0 - Backing up saving yum history id" + /usr/bin/yum history list | awk 'NR == 4 {print $1}' > /tmp/yum-rollback-id.ipa-tests + + t_Log "Running $0 - Cleaning up hosts file" + sed -i "s/127.0.0.1 $(hostname)//" /etc/hosts + + t_Log "Running $0 - Cleaning previous tomcat/pki instances if any" + yum remove -d0 -y tomcat ipa-server >/dev/null 2>&1 + /bin/rm -Rf /var/lib/pki/pki-tomcat/ /etc/sysconfig/pki-tomcat /var/log/pki/pki-tomcat /etc/pki/pki-tomcat /etc/sysconfig/pki/tomcat/pki-tomcat + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_ipa-server/1-install_freeipa.sh b/tests/p_ipa-server/1-install_freeipa.sh new file mode 100755 index 0000000..6749a68 --- /dev/null +++ b/tests/p_ipa-server/1-install_freeipa.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') + then + t_Log "Running $0 - Installing packages, this takes around 2-3 mins" + t_InstallPackage ipa-server bind-dyndb-ldap libsss_sudo +else + echo "Skipped on CentOS 5" +fi + + diff --git a/tests/p_ipa-server/2-configure_freeipa.sh b/tests/p_ipa-server/2-configure_freeipa.sh new file mode 100755 index 0000000..f368dc0 --- /dev/null +++ b/tests/p_ipa-server/2-configure_freeipa.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Author: James Hogarth +# +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') + then + + t_Log "Running $0 - setting hostname of system" + eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') + eth_ip=$(ip -4 addr show dev $eth_int | awk '$0 ~ /scope global/ {print $2}' | cut -d'/' -f 1) + if [ "$centos_ver" = "7" ] ; then + hostnamectl set-hostname c6test.c6ipa.local + else + hostname c6test.c6ipa.local + fi + + echo $eth_ip $(hostname) >> /etc/hosts + hostname | grep "c6test.c6ipa.local" &> /dev/null + t_CheckExitStatus $? + + + t_Log "Running $0 - Configuring IPA server - this can take some time" + + ipa-server-install -U --hostname=c6test.c6ipa.local --ip-address=$eth_ip -r C6IPA.LOCAL -n c6ipa.local -p p455w0rd -a p455w0rd --ssh-trust-dns --setup-dns --forwarder=$(awk '$0 ~ /nameserver/ {print $2}' /etc/resolv.conf | head -n 1) + + t_CheckExitStatus $? + + t_Log "Running $0 - Enabling mkhomedir" + authconfig --enablemkhomedir --enablesssd --update + t_CheckExitStatus $? + + if /sbin/service sssd status | grep 'is stopped' &> /dev/null + then + /sbin/service sssd start &> /dev/null + fi + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_ipa-server/3-verify_kerberos_tickets.sh b/tests/p_ipa-server/3-verify_kerberos_tickets.sh new file mode 100755 index 0000000..8385210 --- /dev/null +++ b/tests/p_ipa-server/3-verify_kerberos_tickets.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') +then + +# kinit cannot take password from stdin so use expect + +t_InstallPackage expect + +t_Log "Running $0 - testing host kerberos principal" +klist -k /etc/krb5.keytab | grep "host/c6test.c6ipa.local" &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - testing admin user kerberos principal" + +kdestroy &> /dev/null + +klist 2>&1 | grep "No credentials" &> /dev/null + +t_CheckExitStatus $? + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_ipa-server/4-adduser.sh b/tests/p_ipa-server/4-adduser.sh new file mode 100755 index 0000000..a950483 --- /dev/null +++ b/tests/p_ipa-server/4-adduser.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep "No credentials" &> /dev/null + +t_CheckExitStatus $? + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + + + +t_Log "Running $0 - test adding user" +userdetails="$(ipa user-add --first=test --last=user --random ipatestuser)" +echo "$userdetails" | grep 'Added user "ipatestuser"' &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - verify details of user" + +echo "$userdetails" | grep ' First name: test' &> /dev/null + +t_CheckExitStatus $? + +echo "$userdetails" | grep 'Last name: user' &> /dev/null + +t_CheckExitStatus $? + +echo "$userdetails" | grep 'Full name: test user' &> /dev/null + +t_CheckExitStatus $? + +echo "$userdetails" | grep 'Home directory: /home/ipatestuser' &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - testing initial password change of user" +kdestroy &> /dev/null + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + +kdestroy &> /dev/null + + +t_Log "Running $0 - testing ipatestuser is in getent" +getent passwd ipatestuser &> /dev/null +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5" +fi + + diff --git a/tests/p_ipa-server/5-addservice.sh b/tests/p_ipa-server/5-addservice.sh new file mode 100755 index 0000000..fe407fc --- /dev/null +++ b/tests/p_ipa-server/5-addservice.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep "No credentials" &> /dev/null + +t_CheckExitStatus $? + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + + +t_Log "Running $0 - Adding test service" +ipa service-add testservice/c6test.c6ipa.local &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - getting keytab for service" +ipa-getkeytab -s c6test.c6ipa.local -p testservice/c6test.c6ipa.local -k /tmp/testservice.keytab &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - getting certificate for service" +ipa-getcert request -K testservice/c6test.c6ipa.local -D c6test.c6ipa.local -f /etc/pki/tls/certs/testservice.crt -k /etc/pki/tls/private/testservice.key &> /dev/null +t_CheckExitStatus $? + +while true +do +entry="$(ipa-getcert list -r | sed -n '/Request ID/,/auto-renew: yes/p')" +if [[ $entry =~ "status:" ]] && [[ $entry =~ "CA_REJECTED" ]] +then +t_CheckExitStatus 1 +break +fi +if [[ $entry =~ "" ]] +then +t_CheckExitStatus 0 +break +fi +sleep 1 +done + +#avoiding race condition of certmonger getting the certificates and writing them but not actually on disk yet +while ! stat /etc/pki/tls/certs/testservice.crt &> /dev/null +do +sync +sleep 1 +done + +t_Log "Running $0 - verifying keytab" +klist -k /tmp/testservice.keytab | grep "testservice/c6test.c6ipa.local" &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - verifying key matches certificate" +diff <(openssl x509 -in /etc/pki/tls/certs/testservice.crt -noout -modulus 2>&1 ) <(openssl rsa -in /etc/pki/tls/private/testservice.key -noout -modulus 2>&1 ) +t_CheckExitStatus $? + +t_Log "Running $0 - verifying certificate against CA" +openssl verify -CAfile /etc/ipa/ca.crt /etc/pki/tls/certs/testservice.crt | grep "/etc/pki/tls/certs/testservice.crt: OK" &> /dev/null +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5" +fi + + diff --git a/tests/p_ipa-server/6-dnsdetails.sh b/tests/p_ipa-server/6-dnsdetails.sh new file mode 100755 index 0000000..0051233 --- /dev/null +++ b/tests/p_ipa-server/6-dnsdetails.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep "No credentials" &> /dev/null + +t_CheckExitStatus $? + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + +#Add zone +t_Log "Running $0 - Adding a subdomain 'testzone'" +ipa dnszone-add --name-server=c6test.c6ipa.local. --admin-email=hostmaster.testzone.c6ipa.local. testzone.c6ipa.local &> /dev/null +t_CheckExitStatus $? + +#Can get SOA for new zone from DNS + +#Add record to standard zone +t_Log "Running $0 - Adding a testrecord to main domain" +ipa dnsrecord-add c6ipa.local testrecord --cname-hostname=c6test &> /dev/null +t_CheckExitStatus $? + +#Can get record from DNS +t_Log "Running $0 - Testing can retrieve record" +dig @localhost -t CNAME testrecord.c6ipa.local | grep "status: NOERROR" &> /dev/null +t_CheckExitStatus $? + +#Add record to new zone +t_Log "Running $0 - Adding a testrecord to subdomain" +ipa dnsrecord-add testzone.c6ipa.local testrecord --cname-hostname=c6test.c6ipa.local. &> /dev/null +t_CheckExitStatus $? + +#Can get record from DNS for new zone +t_Log "Running $0 - Testing can retrieve record from subdomain" +dig @localhost -t CNAME testrecord.testzone.c6ipa.local | grep "status: NOERROR" &> /dev/null +t_CheckExitStatus $? + +#Configure global options instead of named.conf for forwarders - note this is looking for an ipv4 adddress ... there is no testing on ipv6 at this point +t_Log "Running $0 - Changing configuration to use LDAP for forwarder configuration" +forwarder="$(sed -n '1,/forwarders/!{ /};/,/forwarders/!s/^//p;}' /etc/named.conf | sed 's/^[ \t]*\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\);$/\1/')" +sed -i '/forwarders/{N ; s/\n.*// }' /etc/named.conf +service named restart +t_CheckExitStatus $? +ipa dnsconfig-mod --forwarder=${forwarder} &> /dev/null +t_CheckExitStatus $? + +#Regression test of RHBA-2103-0739 +for i in {1..30} +do +service named reload &> /dev/null +service named status &> /dev/null || t_CheckExitStatus $? +sleep 1 +done + +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_ipa-server/7-addsudo.sh b/tests/p_ipa-server/7-addsudo.sh new file mode 100755 index 0000000..4771c49 --- /dev/null +++ b/tests/p_ipa-server/7-addsudo.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep "No credentials" &> /dev/null + +t_CheckExitStatus $? + +expect -f - &> /dev/null < /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - test adding sudo command" +ipa sudorule-add test_rule --desc="Test rule in ipa testing" --hostcat=all --cmdcat=all --runasusercat=all --runasgroupcat=all &> /dev/null +t_CheckExitStatus $? +ipa sudorule-add-user test_rule --users="ipatestuser" &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - verifying sudo command is in freeipa" +sudodetails="$(ipa sudorule-show test_rule)" +echo "$sudodetails" | grep 'Rule name: test_rule' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Description: Test rule in ipa testing' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Enabled: TRUE' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Host category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Command category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'RunAs User category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'RunAs Group category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Users: ipatestuser' &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - test adding sudo configuration" +echo "sudoers: files sss" >> /etc/nsswitch.conf +sed -i 's/services = nss, pam, ssh/services = nss, pam, ssh, sudo/' /etc/sssd/sssd.conf +sed -i 's/id_provider = ipa/id_provider = ipa\nsudo_provider = ldap\nldap_sudo_search_base = ou=sudoers,dc=c6ipa,dc=local\nldap_sasl_mech = GSSAPI/' /etc/sssd/sssd.conf + +t_Log "Running $0 - clearing the sssd cache" +/sbin/service sssd stop &> /dev/null +rm -rf /var/lib/sss/db/* +/sbin/service sssd start &> /dev/null +/sbin/service sssd status | grep 'running' &> /dev/null +t_CheckExitStatus $? + +## Leaving a little time to settle as there seems to be a slight race condition to go right away +sleep 10 + +t_Log "Running $0 - test sudo works" +expect -f - &> /tmp/sudotestoutput.ipa-test < /dev/null +t_CheckExitStatus $? +grep '(ALL) ALL' /tmp/sudotestoutput.ipa-test &> /dev/null +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_ipa-server/99-postclean.sh b/tests/p_ipa-server/99-postclean.sh new file mode 100755 index 0000000..ce77b3f --- /dev/null +++ b/tests/p_ipa-server/99-postclean.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') + then + + t_Log "Running $0 - Restoring up resolv.conf" + cp /tmp/resolv.conf.ipa-tests /etc/resolv.conf + + t_Log "Running $0 - Restoring nsswitch.conf" + cp /tmp/nsswitch.conf.ipa-tests /etc/nsswitch.conf + + t_Log "Running $0 - Restoring hosts file" + cp /tmp/hosts.ipa-tests /etc/hosts + + if [[ -f /tmp/ntp.conf.ipa-tests ]] + then + t_Log "Running $0 - Restoring ntp.conf file" + cp /tmp/ntp.conf.ipa-tests /etc/ntp.conf + fi + + t_Log "Running $0 - Rolling back to yum history id - this will take some time" + /usr/bin/yum -y history rollback $(cat /tmp/yum-rollback-id.ipa-tests) &> /dev/null + + rm -f /tmp/*.ipa-test /etc/httpd/conf.d/* + + if [ "$centos_ver" = "7" ] ; then + hostnamectl set-hostname $(cat /tmp/hostname.ipa-tests) + else + hostname $(cat /tmp/hostname.ipa-tests) + fi + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_iptables/iptables_add-remove_test.sh b/tests/p_iptables/iptables_add-remove_test.sh index ce804fa..13cccfe 100755 --- a/tests/p_iptables/iptables_add-remove_test.sh +++ b/tests/p_iptables/iptables_add-remove_test.sh @@ -2,6 +2,14 @@ # Author: Christoph Galuschka t_Log "Running $0 - verify iptables can insert and delete rules" + +if [ "$centos_ver" = "7" ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + + ACL='INPUT -s 1.2.3.4/32 -d 5.6.7.8/32 -p tcp -m tcp --dport 22 -j ACCEPT' FILE=/var/tmp/iptables_acl diff --git a/tests/p_iptables/iptables_default_rules.sh b/tests/p_iptables/iptables_default_rules.sh index c76b64d..82965f6 100755 --- a/tests/p_iptables/iptables_default_rules.sh +++ b/tests/p_iptables/iptables_default_rules.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - check iptables default rules" +if [ "$centos_ver" = "7" ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + if [ $SKIP_QA_HARNESS -eq 1 ]; then echo "Skip, No standard firewall config ..." else diff --git a/tests/p_iptables/iptables_function-check_test.sh b/tests/p_iptables/iptables_function-check_test.sh index 66337c4..68cf6cb 100755 --- a/tests/p_iptables/iptables_function-check_test.sh +++ b/tests/p_iptables/iptables_function-check_test.sh @@ -4,6 +4,13 @@ t_Log "Running $0 - iptables functional check - deny ping on loopback" +if [ "$centos_ver" = "7" ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + + ACL='INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -p icmp -m icmp -j REJECT' COUNT='4' DEADTIME='1' diff --git a/tests/p_iptraf/5-test_iptraf.sh b/tests/p_iptraf/5-test_iptraf.sh index 16fdadc..40b0acd 100755 --- a/tests/p_iptraf/5-test_iptraf.sh +++ b/tests/p_iptraf/5-test_iptraf.sh @@ -11,12 +11,16 @@ trap "[ -e ${TMP} ] && { /bin/rm ${TMP}; }" EXIT # iptraf only be run by root [ ${EUID} -eq 0 ] || { t_Log "Not running as root, skipping this test. Non-fatal."; exit $PASS; } -IPTRAF=`which iptraf` +if [ "$centos_ver" = "7" ] ; then + IPTRAF=`which iptraf-ng` +else + IPTRAF=`which iptraf` +fi PING=`which ping` STAT=`which stat` KILL=`which kill` -[ "$IPTRAF" ] || { t_log "Failed to find iptraf binary. That ain't good..."; exit $FAIL; } +[ "$IPTRAF" ] || { t_Log "Failed to find iptraf binary. That ain't good..."; exit $FAIL; } [ "$PING" ] || { t_Log "Failed to find the ping binary. That ain't good..."; exit $FAIL; } [ "$STAT" ] || { t_Log "Failed to find the stat binary. That ain't good..."; exit $FAIL; } [ "$KILL" ] || { t_Log "Failed to find the kill binary. That ain't good..."; exit $FAIL; } @@ -31,8 +35,13 @@ ${PING} -c 5 127.0.0.1 &>/dev/null LOGSIZE=`stat -c '%s' ${TMP}` # kill iptraf -${KILL} -USR2 `pidof iptraf` +${KILL} -USR2 `pidof $IPTRAF` # confirm our iptraf log file has something in it -[ ${LOGSIZE} -gt 0 ] || { t_Log "iptraf failed to log any traffic?!. That ain't good..."; exit $FAIL; } +if [ ${LOGSIZE} -gt 0 ] ; then + t_CheckExitStatus 0 +else + t_Log "iptraf failed to log any traffic?!. That ain't good..." + t_CheckExitStatus 1 +fi diff --git a/tests/p_jwhois/0-install_jwhois.sh b/tests/p_jwhois/0-install_jwhois.sh index c5163b2..f9f9ad1 100755 --- a/tests/p_jwhois/0-install_jwhois.sh +++ b/tests/p_jwhois/0-install_jwhois.sh @@ -2,5 +2,12 @@ # Author: Athmane Madjoudj # nc (netcat) is required for the test -t_InstallPackage jwhois nc + +if [ "$centos_ver" = "7" ] ;then + whois_pkg="whois" +else + whois_pkg="jwhois" +fi + +t_InstallPackage $whois_pkg nc diff --git a/tests/p_logwatch/logwatch_test.sh b/tests/p_logwatch/logwatch_test.sh index 95a487a..fe25128 100755 --- a/tests/p_logwatch/logwatch_test.sh +++ b/tests/p_logwatch/logwatch_test.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - logwatch test." -logwatch --print | grep -q 'Logwatch End' +if [ "$centos_ver" = "7" ] ; then + lw_options="--range Today" +else + lw_options="--range Today --print" +fi + +logwatch ${lw_options}| grep -q 'Logwatch End' t_CheckExitStatus $? diff --git a/tests/p_lynx/lynx_dump_page_test.sh b/tests/p_lynx/lynx_dump_page_test.sh index 15a2fc8..0f5de17 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 [ $SKIP_QA_HARNESS -eq 1 ]; then +if [ "$SKIP_QA_HARNESS" = "1" ] ; then URL="http://ci.dev.centos.org/cstatic/" CHECK_FOR="CentOS CI test page" else diff --git a/tests/p_mysql/0-install_mysqld.sh b/tests/p_mysql/0-install_mysqld.sh index 46b96f1..f055837 100755 --- a/tests/p_mysql/0-install_mysqld.sh +++ b/tests/p_mysql/0-install_mysqld.sh @@ -4,19 +4,20 @@ t_Log "Running $0 - installing and starting mysql server." -if [ $centos_ver -gt 6 ] -then - t_Log 'mysql is only supported on C5 and C6, skipping' - t_CheckExitStatus 0 - exit 0 -fi - # MySQL # starting with 5.10, we have to add mysql55 -if [ $centos_ver = 5 ] -then - t_InstallPackage mysql55-mysql-server mysql-server nc + +if [ "$centos_ver" = "7" ] ; then + my_packages="mariadb mariadb-server nc" + mysql_service="mariadb" +elif [ "$centos_ver" = "5" ] ;then + my_packages="mysql mysql-server nc mysql55-mysql-server" + mysql_service="mysqld" else - t_InstallPackage mysql-server nc + my_packages="mysql mysql-server nc" + mysql_service="mysqld" fi -t_ServiceControl mysqld start >/dev/null 2>&1 + +t_InstallPackage ${my_packages} + +t_ServiceControl ${mysql_service} start >/dev/null 2>&1 diff --git a/tests/p_mysql/10_mysqld_conn_test.sh b/tests/p_mysql/10_mysqld_conn_test.sh index 9a9eaf8..edf5d73 100755 --- a/tests/p_mysql/10_mysqld_conn_test.sh +++ b/tests/p_mysql/10_mysqld_conn_test.sh @@ -2,12 +2,6 @@ t_Log "Running $0 - mysqld client can talk to mysql server." -if [ $centos_ver -gt 6 ] -then - t_Log 'mysql is only supported on C5 and C6, skipping' - t_CheckExitStatus 0 - exit 0 -fi HostName=$(hostname -s) MySqlHostName=$(mysql -N -B -u root -e "show variables like 'hostname'" | cut -f 2 | cut -d . -f 1) @@ -25,7 +19,7 @@ t_Log "Running $0 - mysqld listening test." grep 'skip-networking' /etc/my.cnf > /dev/null if [ $? -eq 1 ]; then # FIXME: Test is very basic - nc -d -w 1 localhost 3306 >/dev/null 2>&1 + >/dev/null 2>&1 >/dev/tcp/localhost/3306 t_CheckExitStatus $? else t_Log "Skipped, looks like networking is disabled for mysql" diff --git a/tests/p_network/network_device_test.sh b/tests/p_network/network_device_test.sh index 0235fea..ef7369c 100755 --- a/tests/p_network/network_device_test.sh +++ b/tests/p_network/network_device_test.sh @@ -3,6 +3,8 @@ t_Log "Running $0 - Check if a least one network device is available." -ifconfig | grep -q eth0 +ifconfig | grep -q ether + +export eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') t_CheckExitStatus $? diff --git a/tests/p_network/networking_enabled_test.sh b/tests/p_network/networking_enabled_test.sh index 84e54c2..9131395 100755 --- a/tests/p_network/networking_enabled_test.sh +++ b/tests/p_network/networking_enabled_test.sh @@ -3,7 +3,10 @@ t_Log "Running $0 - Check if networking is enabled." -grep -Eqi "NETWORKING=.*yes" /etc/sysconfig/network - - -t_CheckExitStatus $? +if [ "$centos_ver" = "7" ] ; then + t_Log "CentOS $centos_ver -> SKIP" + exit 0 +else + grep -Eqi "NETWORKING=.*yes" /etc/sysconfig/network + t_CheckExitStatus $? +fi diff --git a/tests/p_network/networking_vlan_test.sh b/tests/p_network/networking_vlan_test.sh index c4b2c30..9a6f655 100755 --- a/tests/p_network/networking_vlan_test.sh +++ b/tests/p_network/networking_vlan_test.sh @@ -11,9 +11,12 @@ then fi t_Log 'This is no C5-system, commencing test' -# create VLAN-IF 10 on eth0 -ip link add dev eth0.10 link eth0 type vlan id 10 -ip addr list | grep -q eth0.10 + +export eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') + +# create VLAN-IF 10 on ethernet device +ip link add dev ${eth_int}.10 link ${eth_int} type vlan id 10 +ip addr list | grep -q ${eth_int}.10 if [ $? == 1 ] then t_Log "VLAN-IF creation failed" @@ -23,29 +26,29 @@ else fi #assign IP address on VLAN-IF -ip address add 172.16.30.1/32 dev eth0.10 +ip address add 172.16.30.1/32 dev ${eth_int}.10 ip addr list | grep -q 172.16.30.1 if [ $? == 1 ] then - t_Log "IP address assignment on eth0.10 failed" + t_Log "IP address assignment on ${eth_int}.10 failed" ret_val=1 else - t_Log "IP address successfully assigned on eth0.10" + t_Log "IP address successfully assigned on ${eth_int}.10" fi #testing address with ping ping -c 4 -q 172.16.30.1 | grep -q '4 received' if [ $? == 1 ] then - t_Log "pinging on eth0.10 failed" + t_Log "pinging on ${eth_int}.10 failed" ret_val=1 else t_Log "local ping on VLAN IF worked" fi -# delete VLAN-IF 10 on eth0 -ip link delete eth0.10 -ip addr list | grep -q eth0.10 +# delete VLAN-IF 10 on ethernet interface +ip link delete ${eth_int}.10 +ip addr list | grep -q ${eth_int}.10 if [ $? == 0 ] then t_Log "Removing VLAN IF failed" diff --git a/tests/p_openssh/sshd_conn_test.sh b/tests/p_openssh/sshd_conn_test.sh index 50e3a5a..d1014b7 100755 --- a/tests/p_openssh/sshd_conn_test.sh +++ b/tests/p_openssh/sshd_conn_test.sh @@ -5,6 +5,6 @@ t_Log "Running $0 - SSHD is listening test." -nc -w 1 localhost 22 > /dev/null 2>&1 +>/dev/null 2>&1 >/dev/tcp/localhost/22 t_CheckExitStatus $? diff --git a/tests/p_passwd/_password_complexity.expect b/tests/p_passwd/_password_complexity.expect index 6b73c62..d0babe4 100755 --- a/tests/p_passwd/_password_complexity.expect +++ b/tests/p_passwd/_password_complexity.expect @@ -12,10 +12,13 @@ expect { "password:" { send "$testpassword\r" expect { + "BAD PASSWORD: is a palindrome" { exit 0 } + "BAD PASSWORD: The password is a palindrome" { exit 0 } "BAD PASSWORD: it is WAY too short" { exit 0 } + "BAD PASSWORD: The password is shorter than 8 characters" { exit 0 } "BAD PASSWORD: it is too short" { exit 0 } "BAD PASSWORD: it does not contain enough DIFFERENT characters" { exit 0 } - "BAD PASSWORD: is a palindrome" { exit 0 } + "BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters" { exit 0 } } } } diff --git a/tests/p_procinfo/0-install_procinfo.sh b/tests/p_procinfo/0-install_procinfo.sh index 2651497..868c8a6 100755 --- a/tests/p_procinfo/0-install_procinfo.sh +++ b/tests/p_procinfo/0-install_procinfo.sh @@ -5,9 +5,8 @@ t_Log "Running $0 - attempting to install procinfo" -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log "It seems to be a CentOS 6.x system, this test will be disabled" +if [ "$centos_ver" -gt "5" ] ; then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" exit 0 else # ProcInfo Utility Package diff --git a/tests/p_procinfo/5-test_procinfo.sh b/tests/p_procinfo/5-test_procinfo.sh index ed545f0..67fba24 100755 --- a/tests/p_procinfo/5-test_procinfo.sh +++ b/tests/p_procinfo/5-test_procinfo.sh @@ -5,9 +5,8 @@ t_Log "Running $0 - checking procinfo runs and returns non-zero exit status." -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log "It seems to be a CentOS 6.x system, this test will be disabled" +if [ "$centos_ver" -gt "5" ] ; then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" exit 0 else if [ $SKIP_QA_HARNESS -eq 1 ]; then diff --git a/tests/p_python/20-python-mysql-test.sh b/tests/p_python/20-python-mysql-test.sh index 3d2cbe1..4ba598d 100755 --- a/tests/p_python/20-python-mysql-test.sh +++ b/tests/p_python/20-python-mysql-test.sh @@ -6,13 +6,19 @@ t_Log "Running $0 - python can retrieve mysql-server version information." # we need a working and running mysql server # starting with 5.10, we have to differ between mysql55 and mysql -if [ $centos_ver = 5 ] -then - t_InstallPackage mysql55-mysql-server mysql-server + +if [ "$centos_ver" = "7" ] ; then + my_packages="mariadb mariadb-server nc" + mysql_service="mariadb" +elif [ "$centos_ver" = "5" ] ;then + my_packages="mysql mysql-server nc mysql55-mysql-server" + mysql_service="mysqld" else - t_InstallPackage mysql-server + my_packages="mysql mysql-server nc" + mysql_service="mysqld" fi -t_ServiceControl mysqld start >/dev/null 2>&1 + +t_ServiceControl ${mysql_service} start >/dev/null 2>&1 # Installing additional python/mysql module t_InstallPackage MySQL-python diff --git a/tests/p_python/25-python-mysql55-test.sh b/tests/p_python/25-python-mysql55-test.sh index ed62c3a..a3d6242 100755 --- a/tests/p_python/25-python-mysql55-test.sh +++ b/tests/p_python/25-python-mysql55-test.sh @@ -6,6 +6,7 @@ t_Log "Running $0 - python can retrieve mysql55-mysql-server version information # we need a working and running mysql server # starting with 5.10, we have to differ between mysql55 and mysql + if [ $centos_ver = 5 ] then t_ServiceControl mysqld stop diff --git a/tests/p_rsync/0-install-rsync.sh b/tests/p_rsync/0-install-rsync.sh index f0efada..50637cf 100755 --- a/tests/p_rsync/0-install-rsync.sh +++ b/tests/p_rsync/0-install-rsync.sh @@ -4,8 +4,11 @@ t_Log "Running $0 - installing rsync and xinetd." t_InstallPackage xinetd rsync -# enable rsync in /etc/xinet.d/rsync -sed -i 's/\(disable\s*=\ \)yes/\1no/' /etc/xinetd.d/rsync - # Restart in case previous tests allready installed xinetd -t_ServiceControl xinetd restart +if [ "$centos_ver" = "7" ] ; then + systemctl start rsyncd.service +else + # enable rsync in /etc/xinet.d/rsync + sed -i 's/\(disable\s*=\ \)yes/\1no/' /etc/xinetd.d/rsync + t_ServiceControl xinetd restart +fi diff --git a/tests/p_rsync/10-rsync-test.sh b/tests/p_rsync/10-rsync-test.sh index 41625d5..7756168 100755 --- a/tests/p_rsync/10-rsync-test.sh +++ b/tests/p_rsync/10-rsync-test.sh @@ -13,6 +13,7 @@ cat > $PATH2FILE/$FILE < /etc/rsyncd.conf < t_Log "Running $0 - Check version of ruby." -if [ $centos_ver = 6 ] - then + +if [ "$centos_ver" = "7" ] ; then + ruby -v | grep -q '2.0' + ret_val=$? +elif [ "$centos_ver" = "6" ] ; then ruby -v | grep -q '1.8.7' ret_val=$? else diff --git a/tests/p_ruby/30-irb-version-test.sh b/tests/p_ruby/30-irb-version-test.sh index 12311f4..ac7a88e 100755 --- a/tests/p_ruby/30-irb-version-test.sh +++ b/tests/p_ruby/30-irb-version-test.sh @@ -8,9 +8,8 @@ t_Log "Running $0 - Check version of irb." #allready prepared just in case versions should change between C5 and C6 -if [ $centos_ver = 5 ] - then - irb -v | grep -q '0.9.5' +if [ "$centos_ver" = "7" ] ; then + irb -v | grep -q '0.9.6' ret_val=$? else irb -v | grep -q '0.9.5' diff --git a/tests/p_ruby/40-ri-version-test.sh b/tests/p_ruby/40-ri-version-test.sh index 017fb76..75acf70 100755 --- a/tests/p_ruby/40-ri-version-test.sh +++ b/tests/p_ruby/40-ri-version-test.sh @@ -8,9 +8,8 @@ t_Log "Running $0 - Check version of ruby ri." #allready prepared just in case versions should change between C5 and C6 -if [ $centos_ver = 5 ] - then - ri -v | grep -q '1.0.1' +if [ "$centos_ver" = "7" ] ; then + ri -v | grep -q '4.0' ret_val=$? else ri -v | grep -q '1.0.1' diff --git a/tests/p_ruby/50-rdoc-version-test.sh b/tests/p_ruby/50-rdoc-version-test.sh index 986b4c3..cf7a440 100755 --- a/tests/p_ruby/50-rdoc-version-test.sh +++ b/tests/p_ruby/50-rdoc-version-test.sh @@ -8,10 +8,10 @@ t_Log "Running $0 - Check version of rdoc." #allready prepared just in case versions should change between C5 and C6 -if [ $centos_ver = 5 ] - then - rdoc -v | grep -q '1.0.1' - ret_val=$? +if [ "$centos_ver" = "7" ] ; then + t_Log "CentOS $centos_ver rdoc has no version in cli -> SKIP" + t_CheckExitStatus 0 + exit 0 else rdoc -v | grep -q '1.0.1' ret_val=$? diff --git a/tests/p_sendmail/10_sendmail_smtp.sh b/tests/p_sendmail/10_sendmail_smtp.sh index dba02b1..7ec11dd 100755 --- a/tests/p_sendmail/10_sendmail_smtp.sh +++ b/tests/p_sendmail/10_sendmail_smtp.sh @@ -3,6 +3,6 @@ t_Log "Running $0 - Sendmail SMTP test." -echo "helo test" | nc -w 3 localhost 25 | grep -q '250' +echo "helo test" | nc -4 -w 3 localhost 25 | grep -q '250' t_CheckExitStatus $? diff --git a/tests/p_sendmail/20_sendmail_mta.sh b/tests/p_sendmail/20_sendmail_mta.sh index 69a5c38..38d4fbe 100755 --- a/tests/p_sendmail/20_sendmail_mta.sh +++ b/tests/p_sendmail/20_sendmail_mta.sh @@ -10,7 +10,7 @@ cat /dev/null > $MAILSPOOL ret_val=1 # send mail to localhost -echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" +echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -4 -w 5 localhost 25 | grep -q "250 2.0.0" if [ $? = 0 ] then t_Log 'Mail has been queued successfully' diff --git a/tests/p_sendmail/30_sendmail_mta_ehlo.sh b/tests/p_sendmail/30_sendmail_mta_ehlo.sh index dfc7274..7d9df26 100755 --- a/tests/p_sendmail/30_sendmail_mta_ehlo.sh +++ b/tests/p_sendmail/30_sendmail_mta_ehlo.sh @@ -1,32 +1,31 @@ -#!/bin/sh +#!/bin/bash # Author: Christoph Galuschka t_Log "Running $0 - sendmail can accept and deliver local email using ESMTP." -MAILSPOOL=/var/spool/mail/root +MAILSPOOL="/var/spool/mail/root" # make shure spool file is empty -cat /dev/null > $MAILSPOOL +cat /dev/null > ${MAILSPOOL} ret_val=1 # send mail to localhost -echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" -if [ $? = 0 ] +echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -4 -w 5 localhost 25 | grep -q "250 2.0.0" +if [ "$?" = "0" ] then t_Log 'Mail has been queued successfully' - MTA_ACCEPT=0 + MTA_ACCEPT="0" fi -sleep 1 -grep -q 't_functional test' $MAILSPOOL -if [ $? = 0 ] +sleep 3 +grep -q 't_functional test' ${MAILSPOOL} +if [ "$?" = "0" ] then - t_Log 'previously sent mail is in '$MAILSPOOL - SPOOLFILE=0 + t_Log "previously sent mail is in ${MAILSPOOL}" + SPOOLFILE="0" fi -if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) - then +if [[ "$MTA_ACCEPT" = "0" && "$SPOOLFILE" = "0" ]] ; then ret_val=0 fi diff --git a/tests/p_squirrelmail/0-install_squirrelmail.sh b/tests/p_squirrelmail/0-install_squirrelmail.sh index 6905b5a..36ea64e 100755 --- a/tests/p_squirrelmail/0-install_squirrelmail.sh +++ b/tests/p_squirrelmail/0-install_squirrelmail.sh @@ -5,10 +5,9 @@ # Squirellmail has been removed from el6 t_Log "Running $0 - install squirrelmail" -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log It seems to be a CentOS 6.x system, this test will be disabled - exit 0 +if [ "$centos_ver" -gt "5" ] ;then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" + exit 0 else t_InstallPackage squirrelmail t_ServiceControl httpd restart diff --git a/tests/p_squirrelmail/squirrelmail_test.sh b/tests/p_squirrelmail/squirrelmail_test.sh index c590be8..5971c9e 100755 --- a/tests/p_squirrelmail/squirrelmail_test.sh +++ b/tests/p_squirrelmail/squirrelmail_test.sh @@ -2,9 +2,9 @@ # Author: Athmane Madjoudj t_Log "Running $0 - test SquirrelMail URL" -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log It seems to be a CentOS 6.x system, this test will be disabled +if [ "$centos_ver" -gt "5" ] ;then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" + exit 0 else curl -s http://localhost/webmail/src/login.php | grep 'SquirrelMail' > /dev/null 2>&1 fi diff --git a/tests/p_tftp-server/10-tftp-server_get-test.sh b/tests/p_tftp-server/10-tftp-server_get-test.sh index 2c98b62..59db0ea 100755 --- a/tests/p_tftp-server/10-tftp-server_get-test.sh +++ b/tests/p_tftp-server/10-tftp-server_get-test.sh @@ -3,8 +3,7 @@ t_Log "Running $0 - tftp-server get file test." -if (t_GetPkgRel basesystem | grep -q el6) -then +if [ "$centos_ver" -gt "5" ] ; then TFTP_DIR=/var/lib/tftpboot else TFTP_DIR=/tftpboot diff --git a/tests/p_tftp-server/20-tftp-server_put-test.sh b/tests/p_tftp-server/20-tftp-server_put-test.sh index d726e5b..2bfaf22 100755 --- a/tests/p_tftp-server/20-tftp-server_put-test.sh +++ b/tests/p_tftp-server/20-tftp-server_put-test.sh @@ -5,17 +5,13 @@ t_Log "Running $0 - tftp-server put file test." -dist=$(t_DistCheck) - -if [ "$dist" = "6" ]; then - setsebool tftp_anon_write 1 - TFTP_DIR=/var/lib/tftpboot -elif [ "$dist" = "5" ]; then - setsebool allow_tftp_anon_write 1 - chcon -R -t tftpdir_rw_t /tftpboot/ - TFTP_DIR=/tftpboot +if [ "$centos_ver" -gt "5" ]; then + setsebool tftp_anon_write 1 + TFTP_DIR=/var/lib/tftpboot else - TFTP_DIR=/tftpboot + setsebool allow_tftp_anon_write 1 + chcon -R -t tftpdir_rw_t /tftpboot/ + TFTP_DIR=/tftpboot fi diff --git a/tests/p_tomcat/0-install_tomcat.sh b/tests/p_tomcat/0-install_tomcat.sh index e726041..7335b26 100755 --- a/tests/p_tomcat/0-install_tomcat.sh +++ b/tests/p_tomcat/0-install_tomcat.sh @@ -1,11 +1,13 @@ #!/bin/bash # Author: Athmane Madjoudj -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log "$0 - installing Tomcat 6" - t_InstallPackage tomcat6 tomcat6-admin-webapps tomcat6-webapps +if [ "$centos_ver" = "7" ] ;then + tomcat_packages="tomcat tomcat-admin-webapps tomcat-webapps" +elif [ "$centos_ver" = "6" ]; then + tomcat_packages="tomcat6 tomcat6-admin-webapps tomcat6-webapps" else - t_Log "$0 - installing Tomcat 5" - t_InstallPackage tomcat5 tomcat5-admin-webapps tomcat5-webapps + tomcat_packages="tomcat5 tomcat5-admin-webapps tomcat5-webapps" fi + +t_Log "$0 - installing Tomcat packages" +t_InstallPackage ${tomcat_packages} diff --git a/tests/p_tomcat/1-config_tomcat.sh b/tests/p_tomcat/1-config_tomcat.sh index 850cfa0..a272cdc 100755 --- a/tests/p_tomcat/1-config_tomcat.sh +++ b/tests/p_tomcat/1-config_tomcat.sh @@ -3,8 +3,10 @@ t_Log "$0 - Configuring Tomcat" -if (t_GetPkgRel basesystem | grep -q el6) -then +if [ "$centos_ver" = "7" ] ;then + TOMCAT_SRV_NAME=tomcat + TOMCAT_CONF_DIR=/etc/tomcat/ +elif [ "$centos_ver" = "6" ] ; then TOMCAT_SRV_NAME=tomcat6 TOMCAT_CONF_DIR=/etc/tomcat6/ else @@ -12,8 +14,11 @@ else TOMCAT_CONF_DIR=/etc/tomcat5/ fi -sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml - +if [ "$centos_ver" = "7" ] ;then + sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml +else + sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml +fi service $TOMCAT_SRV_NAME restart diff --git a/tests/p_tomcat/tomcat_test.sh b/tests/p_tomcat/tomcat_test.sh index 6329255..3902287 100755 --- a/tests/p_tomcat/tomcat_test.sh +++ b/tests/p_tomcat/tomcat_test.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - Tomcat basic test." -curl -s http://localhost:8080/ | grep "you've setup Tomcat successfully. Congratulations!" >/dev/null 2>&1 +if [ "$centos_ver" = "7" ] ; then + string_tosearch="you've successfully installed Tomcat. Congratulations!" +else + string_tosearch="you've setup Tomcat successfully. Congratulations!" +fi + +curl -s http://localhost:8080/ | grep "${string_tosearch}" >/dev/null 2>&1 t_CheckExitStatus $? diff --git a/tests/p_webalizer/0-install_webalizer.sh b/tests/p_webalizer/0-install_webalizer.sh index a29c8b4..94e360a 100755 --- a/tests/p_webalizer/0-install_webalizer.sh +++ b/tests/p_webalizer/0-install_webalizer.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - attempting to install webalizer" +if [ "$centos_ver" = "7" ] ; then + t_Log "No webalizer package for CentOS $centos_ver -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + t_InstallPackage webalizer t_InstallPackage httpd t_ServiceControl httpd stop diff --git a/tests/p_webalizer/webalizer_test.sh b/tests/p_webalizer/webalizer_test.sh index c90201d..041d835 100755 --- a/tests/p_webalizer/webalizer_test.sh +++ b/tests/p_webalizer/webalizer_test.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - Webalizer test." +if [ "$centos_ver" = "7" ] ; then + t_Log "No webalizer package for CentOS $centos_ver -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + # Run some requests for i in `seq 10` do