diff --git a/Sanity/Master-server-chrooted/Makefile b/Sanity/Master-server-chrooted/Makefile index 7755294..257c238 100644 --- a/Sanity/Master-server-chrooted/Makefile +++ b/Sanity/Master-server-chrooted/Makefile @@ -1,35 +1,34 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Makefile of /CoreOS/bind/Sanity/Master-server-chrooted -# Description: Set up master nameserver, test it. -# Author: Martin Cermak +# Makefile of /CoreOS/tests/Sanity/Master-server-chrooted +# Description: Run basic empty named service and try to resolve localhost on it +# Author: Petr Mensik # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2009 Red Hat, Inc. All rights reserved. +# Copyright (c) 2018 Red Hat, Inc. # -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. # # This program is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. +# PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export TEST=/CoreOS/bind/Sanity/Master-server-chrooted +export TEST=/CoreOS/tests/Sanity/Master-server-chrooted export TESTVERSION=1.0 BUILT_FILES= -FILES=$(METADATA) runtest.sh Makefile PURPOSE named.conf zonefile +FILES=$(METADATA) runtest.sh Makefile PURPOSE .PHONY: all install download clean @@ -46,21 +45,19 @@ clean: include /usr/share/rhts/lib/rhts-make.include $(METADATA): Makefile - @echo "Owner: Martin Cermak " > $(METADATA) + @echo "Owner: Petr Mensik " > $(METADATA) @echo "Name: $(TEST)" >> $(METADATA) @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Set up master nameserver in chrooted env, test it." >> $(METADATA) + @echo "Description: Run basic empty named-chroot service and try to resolve localhost on it" >> $(METADATA) @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 25m" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) @echo "RunFor: bind" >> $(METADATA) - @echo "Requires: bind" >> $(METADATA) - @echo "Requires: bind-chroot" >> $(METADATA) - @echo "Requires: bind-utils" >> $(METADATA) + @echo "Requires: bind bind-utils bind-chroot bind-sdb-chroot" >> $(METADATA) @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) @echo "Confidential: no" >> $(METADATA) @echo "Destructive: no" >> $(METADATA) - @echo "RhtsRequires: library(bind/bind-setup)" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA) rhts-lint $(METADATA) diff --git a/Sanity/Master-server-chrooted/PURPOSE b/Sanity/Master-server-chrooted/PURPOSE index 9999c53..1d01992 100644 --- a/Sanity/Master-server-chrooted/PURPOSE +++ b/Sanity/Master-server-chrooted/PURPOSE @@ -1,6 +1,3 @@ -PURPOSE of /CoreOS/bind/Sanity/Master-server-chrooted -Description: Set up master nameserver in chrooted env, test it. - This is a very basic sanity test for bind9. - The main purpose for me was to learn how - bind works :-) -Author: Martin Cermak +PURPOSE of /CoreOS/tests/Sanity/Master-server-chrooted +Description: Run basic empty named-chroot service and try to resolve localhost on it +Author: Petr Mensik diff --git a/Sanity/Master-server-chrooted/runtest.sh b/Sanity/Master-server-chrooted/runtest.sh index 04415ea..9ab80d2 100755 --- a/Sanity/Master-server-chrooted/runtest.sh +++ b/Sanity/Master-server-chrooted/runtest.sh @@ -1,115 +1,70 @@ #!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# runtest.sh of /CoreOS/bind/Sanity/Master-server-chrooted -# Description: Set up master nameserver, test it. -# Author: Martin Cermak +# runtest.sh of /CoreOS/tests/Sanity/Master-server-chrooted +# Description: Run basic empty named-chroot service and try to resolve localhost on it +# Author: Petr Mensik # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2009 Red Hat, Inc. All rights reserved. +# Copyright (c) 2018 Red Hat, Inc. # -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. # # This program is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. +# PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Include rhts environment -#set -x -. /usr/bin/rhts-environment.sh -. /usr/lib/beakerlib/beakerlib.sh +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 . /usr/share/beakerlib/beakerlib.sh || exit 1 -# Some heplful functions -randomString () { - TEMPSTR=`date +%c%N | md5sum | awk '{print $1}'` - echo ${TEMPSTR:0:8} - unset TEMPSTR +PACKAGE="bind" + +test_service() +{ + local SERVICE="$1" + rlRun "rlServiceStart $SERVICE" + rlRun "dig @localhost localhost | grep '^localhost'" + rlRun "dig @localhost -x 127.0.0.1 | grep 'PTR[[:space:]]\+localhost.$'" 0 "Reverse address works" + rlRun "rlServiceRestore $SERVICE" } -randomIp () { - echo "192.168.1.`echo $[ $RANDOM / 256 + 1 ]`" -} - -randomSerial () { - date +%N -} - -# Variable declarations -CONF="/etc/named.conf" -IP1=`randomIp` -IP2=`randomIp` -IP3=`randomIp` -IP4=`randomIp` -IP5=`randomIp` -SERIAL=`randomSerial` -ORIGPWD=`pwd` - -# The test rlJournalStart rlPhaseStartSetup - rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - - rlRun "rlImport bind/bind-setup" - #rlRun "wget --quiet http://nest.test.redhat.com/mnt/qa/scratch/mcermak/bind-setup.tar.gz && tar xvzf bind-setup.tar.gz > /dev/null && . bind-setup/bind-setup.sh" 0 "Imported bind-setup functions." - - bsBindSetupStart "$ORIGPWD/named.conf" "on" - - rlRun "TDOMAIN=`randomString`.cz" - rlRun "TZONEFILE=$ROOTDIR/var/named/$TDOMAIN.zone" - - # set up /etc/named.conf - rlRun "sed -i \"s//$TDOMAIN/g\" $CONF" - - # set up zonefile - rlRun "cp $ORIGPWD/zonefile $TZONEFILE" - rlRun "chmod a+r $TZONEFILE" - rlRun "sed -i \"s//$TDOMAIN/g\" $TZONEFILE" - rlRun "sed -i \"s//$IP1/g\" $TZONEFILE" - rlRun "sed -i \"s//$IP2/g\" $TZONEFILE" - rlRun "sed -i \"s//$IP3/g\" $TZONEFILE" - rlRun "sed -i \"s//$IP4/g\" $TZONEFILE" - rlRun "sed -i \"s//$IP5/g\" $TZONEFILE" - rlRun "sed -i \"s//$SERIAL/g\" $TZONEFILE" - if rlIsRHEL 5; then - rlRun "cp /etc/named.conf $ROOTDIR/etc/named.conf" - fi - - bsBindSetupDone chroot + rlAssertRpm bind + rlAssertRpm bind-utils + rlAssertRpm bind-chroot rlPhaseEnd - rlPhaseStartTest - # perform tests - rlRun "dig @localhost $TDOMAIN | grep \"^$TDOMAIN\" | head -n 1 | grep \"$IP1\"" - rlRun "dig @localhost server1.$TDOMAIN | grep \"^server1.$TDOMAIN\" | grep \"$IP2\"" - rlRun "dig @localhost server2.$TDOMAIN | grep \"^server2.$TDOMAIN\" | grep \"$IP3\"" - rlRun "dig @localhost dns1.$TDOMAIN | grep \"^dns1.$TDOMAIN\" | grep \"$IP4\"" - rlRun "dig @localhost dns2.$TDOMAIN | grep \"^dns2.$TDOMAIN\" | grep \"$IP5\"" - rlRun "dig @localhost ftp.$TDOMAIN | grep \"^ftp.$TDOMAIN\" | grep \"server1.$TDOMAIN\"" - rlRun "dig @localhost mail.$TDOMAIN | grep \"^mail.$TDOMAIN\" | grep \"server1.$TDOMAIN\"" - rlRun "dig @localhost mail2.$TDOMAIN | grep \"^mail2.$TDOMAIN\" | grep \"server2.$TDOMAIN\"" - rlRun "dig @localhost www.$TDOMAIN | grep \"^www.$TDOMAIN\" | grep \"server2.$TDOMAIN\"" + rlPhaseStartTest "Testing named" + test_service named + rlPhaseEnd + rlPhaseStartTest "Testing named-chroot" + test_service named-chroot + rlPhaseEnd + + rlPhaseStartTest "Testing named-sdb-chroot" + if rpm -q bind-sdb-chroot; then + test_service named-sdb-chroot + else + rlLog "bind-sdb-chroot not installed, skipping it" + fi rlPhaseEnd rlPhaseStartCleanup - bsBindSetupCleanup chroot - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlRun "rm -rf $TZONEFILE" + # noop rlPhaseEnd - rlJournalPrintText +rlJournalPrintText rlJournalEnd diff --git a/Sanity/Master-server-not-chrooted/Makefile b/Sanity/Master-server-not-chrooted/Makefile index 9e9b637..891a9a3 100644 --- a/Sanity/Master-server-not-chrooted/Makefile +++ b/Sanity/Master-server-not-chrooted/Makefile @@ -52,7 +52,7 @@ $(METADATA): Makefile @echo "Path: $(TEST_DIR)" >> $(METADATA) @echo "Description: Set up master nameserver in chrooted env, test it." >> $(METADATA) @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 90m" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) @echo "RunFor: bind" >> $(METADATA) @echo "Requires: bind bind-chroot redhat-lsb" >> $(METADATA) @echo "Requires: bind-utils" >> $(METADATA) diff --git a/Sanity/Master-server-not-chrooted/runtest.sh b/Sanity/Master-server-not-chrooted/runtest.sh index 3f30750..ec62a04 100644 --- a/Sanity/Master-server-not-chrooted/runtest.sh +++ b/Sanity/Master-server-not-chrooted/runtest.sh @@ -99,12 +99,6 @@ rlJournalStart rlRun "dig @localhost www.$TDOMAIN | grep \"^www.$TDOMAIN\" | grep \"server2.$TDOMAIN\"" rlPhaseEnd -#for i in `seq 1 8888888888888888`;do echo "ftp$i IN CNAME server1" >> $TZONEFILE ;done -#service named stop -#sleep 1 -#service named start -#####dig @localhost ftp100.f759b6bf.cz -#dig @localhost ftp88888888.$TDOMAIN | grep \"^ftp.$TDOMAIN\" | grep \"server1.$TDOMAIN\"" rlPhaseStartCleanup bsBindSetupCleanup