Commit b712d12 Initial commit of avahi tests

6 files Merged and Committed by rasibley 2 months ago
Initial commit of avahi tests

    
 1 @@ -0,0 +1,64 @@
 2 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 3 + #
 4 + #   Makefile of /CoreOS/avahi/Sanity/Basic-sanity-test
 5 + #   Description: Tests basic functionality of avahi.
 6 + #   Author: Martin Cermak <mcermak@redhat.com>
 7 + #
 8 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 9 + #
10 + #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.
11 + #
12 + #   This copyrighted material is made available to anyone wishing
13 + #   to use, modify, copy, or redistribute it subject to the terms
14 + #   and conditions of the GNU General Public License version 2.
15 + #
16 + #   This program is distributed in the hope that it will be
17 + #   useful, but WITHOUT ANY WARRANTY; without even the implied
18 + #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 + #   PURPOSE. See the GNU General Public License for more details.
20 + #
21 + #   You should have received a copy of the GNU General Public
22 + #   License along with this program; if not, write to the Free
23 + #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 + #   Boston, MA 02110-1301, USA.
25 + #
26 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 + 
28 + export TEST=/CoreOS/avahi/Sanity/Basic-sanity-test
29 + export TESTVERSION=1.0
30 + 
31 + BUILT_FILES=
32 + 
33 + FILES=$(METADATA) runtest.sh Makefile PURPOSE named.conf zonefile
34 + 
35 + .PHONY: all install download clean
36 + 
37 + run: $(FILES) build
38 + »       ./runtest.sh
39 + 
40 + build: $(BUILT_FILES)
41 + »       test -e runtest.sh || chmod a+x runtest.sh
42 + 
43 + clean:
44 + »       rm -f *~ $(BUILT_FILES)
45 + 
46 + 
47 + include /usr/share/rhts/lib/rhts-make.include
48 + 
49 + $(METADATA): Makefile
50 + »       @echo "Owner:           Martin Cermak <mcermak@redhat.com>" > $(METADATA)
51 + »       @echo "Name:            $(TEST)" >> $(METADATA)
52 + »       @echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
53 + »       @echo "Path:            $(TEST_DIR)" >> $(METADATA)
54 + »       @echo "Description:     Tests basic functionality of avahi." >> $(METADATA)
55 + »       @echo "Type:            Sanity" >> $(METADATA)
56 + »       @echo "TestTime:        10m" >> $(METADATA)
57 + »       @echo "RunFor:          avahi" >> $(METADATA)
58 + »       @echo "Requires:        avahi avahi-tools bind bind-chroot bind-utils" >> $(METADATA)
59 + »       @echo "Priority:        Normal" >> $(METADATA)
60 + »       @echo "License:         GPLv2" >> $(METADATA)
61 + »       @echo "Confidential:    no" >> $(METADATA)
62 + »       @echo "Destructive:     no" >> $(METADATA)
63 + »       @echo "Releases:        -RedHatEnterpriseLinux3 -RedHatEnterpriseLinux4" >> $(METADATA)
64 + 
65 + »       rhts-lint $(METADATA)
 1 @@ -0,0 +1,15 @@
 2 + PURPOSE of /CoreOS/avahi/Sanity/Basic-sanity-test
 3 + Description: Tests basic functionality of avahi.
 4 + Author: Martin Cermak <mcermak@redhat.com>
 5 + 
 6 + My objective was to write a very basic sanity test for avahi. 
 7 + As I'm the avahi newbie, I browsed avahi.org, experimented
 8 + a little with RHEL avahi packages and pinged Lennart, which 
 9 + did not respond.
10 + 
11 + My result is a simple test for the avahi domain name resolver.
12 + It requires the avahi-daemon running. As the RHTS/Beaker is/will
13 + shortly be a closed system without the possibility to reach the 
14 + outside network, this test contains its own nameserver.
15 + 
16 + 
 1 @@ -0,0 +1,11 @@
 2 + options {
 3 +         directory       "/var/named";
 4 +         allow-query     { any; };
 5 + };
 6 + 
 7 + zone "<DOMAIN>" IN {
 8 +   type master;
 9 +   file "<DOMAIN>.zone";
10 +   allow-update { none; };
11 + };
12 + 
 1 @@ -0,0 +1,96 @@
 2 + #!/bin/bash
 3 + # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
 4 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5 + #
 6 + #   runtest.sh of /CoreOS/avahi/Sanity/Basic-sanity-test
 7 + #   Description: Tests basic functionality of avahi.
 8 + #   Author: Martin Cermak <mcermak@redhat.com>
 9 + #   Author: Tomas Dolezal <todoleza@redhat.com> - rhel7 updates
10 + #
11 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 + #
13 + #   Copyright (c) 2013 Red Hat, Inc. All rights reserved.
14 + #
15 + #   This copyrighted material is made available to anyone wishing
16 + #   to use, modify, copy, or redistribute it subject to the terms
17 + #   and conditions of the GNU General Public License version 2.
18 + #
19 + #   This program is distributed in the hope that it will be
20 + #   useful, but WITHOUT ANY WARRANTY; without even the implied
21 + #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22 + #   PURPOSE. See the GNU General Public License for more details.
23 + #
24 + #   You should have received a copy of the GNU General Public
25 + #   License along with this program; if not, write to the Free
26 + #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 + #   Boston, MA 02110-1301, USA.
28 + #
29 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 + 
31 + # Include rhts environment
32 + . /usr/bin/rhts-environment.sh
33 + . /usr/lib/beakerlib/beakerlib.sh
34 + 
35 + TEMPSTR=$(date +%c%N | md5sum | awk '{print $1}' | cut -c -8)
36 + ORIGPWD=$(pwd)
37 + 
38 + IP1='127.0.0.1'
39 + IP2='::1'
40 + 
41 + rlJournalStart
42 +     rlPhaseStartSetup
43 +         rlAssertRpm 'avahi'
44 +         rlAssertRpm 'avahi-tools'
45 + 
46 +         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
47 +         rlRun "pushd $TmpDir"
48 + 
49 +         ROOTDIR="" #using non-chroot
50 +         rlFileBackup /etc/named.conf /etc/resolv.conf
51 +         rlFileBackup --clean /var/named/
52 +         cat $ORIGPWD/named.conf > /etc/named.conf
53 + 
54 +         rlRun "TDOMAIN=$TEMPSTR.cz"
55 +         rlRun "TZONEFILE=$ROOTDIR/var/named/$TDOMAIN.zone"
56 + 
57 +         # set up /etc/named.conf
58 +         rlRun "sed -i \"s/<DOMAIN>/$TDOMAIN/g\" /etc/named.conf"
59 + 
60 +         # set up zonefile
61 +         rlRun "cp $ORIGPWD/zonefile $TZONEFILE"
62 +         rlRun "chmod a+r $TZONEFILE"
63 +         rlRun "sed -i \"s/<DOMAIN>/$TDOMAIN/g\" $TZONEFILE"
64 +         rlRun "sed -i \"s/<IP1>/$IP1/g\" $TZONEFILE"
65 +         rlRun "sed -i \"s/<IP2>/$IP2/g\" $TZONEFILE"
66 +         rlRun "sed -i \"s/<SERIAL>/$(date +%N)/g\" $TZONEFILE"
67 + 
68 +         rlServiceStart named #using non-chroot
69 + 
70 +         # set default resolver
71 +         rlRun "echo nameserver 127.0.0.1 > /etc/resolv.conf"
72 +     rlPhaseEnd
73 + 
74 +     rlPhaseStartTest
75 +         # check bind
76 +         rlRun "dig @localhost server1.$TDOMAIN +short | grep $IP1"
77 +         rlRun "dig AAAA @localhost server2.$TDOMAIN +short | grep $IP2"
78 + 
79 +         # turn on avahi or restart it with new resolv.conf
80 +         rlServiceStart "avahi-daemon"
81 + 
82 +         # the test itself...
83 +         rlRun "avahi-resolve -4n server1.$TDOMAIN | grep '127.0.0.1'" 0 "Test the IPv4 avahi DN resolver."
84 +         rlRun "avahi-resolve -6n server2.$TDOMAIN | grep '::1'" 0 "Test the IPv6 avahi DN resolver."
85 + 
86 +     rlPhaseEnd
87 + 
88 +     rlPhaseStartCleanup
89 +         rlFileRestore
90 +         rlServiceStart avahi-daemon
91 +         rlServiceRestore named avahi-daemon
92 + 
93 +         rlRun "popd"
94 +         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
95 +     rlPhaseEnd
96 +  rlJournalPrintText
97 + rlJournalEnd
 1 @@ -0,0 +1,23 @@
 2 + $ORIGIN <DOMAIN>.
 3 + $TTL 86400
 4 + @     IN     SOA    dns1.<DOMAIN>.  hostmaster.<DOMAIN>. (
 5 +                     <SERIAL>  ; serial
 6 +                     21600      ; refresh after 6 hours
 7 +                     3600       ; retry after 1 hour
 8 +                     604800     ; expire after 1 week
 9 +                     86400 )    ; minimum TTL of 1 day
10 + 
11 +       IN     NS     dns1.<DOMAIN>.
12 +       IN     NS     dns2.<DOMAIN>.
13 + 
14 +       IN     MX     10     mail.<DOMAIN>.
15 +       IN     MX     20     mail2.<DOMAIN>.
16 + 
17 +              IN     A       <IP1>
18 + 
19 + server1      IN     A       <IP1>
20 + server2      IN     AAAA    <IP2>
21 + 
22 + dns1         IN     A       <IP1>
23 + dns2         IN     A       <IP1>
24 + 
 1 @@ -0,0 +1,16 @@
 2 + ---
 3 + 
 4 + # Tests that run in classic context
 5 + - hosts: localhost
 6 +   roles:
 7 +   - role: standard-test-beakerlib
 8 +     tags:
 9 +     - classic
10 +     tests:
11 +     - Basic-sanity-test
12 +     required_packages:
13 +     - avahi
14 +     - avahi-tools
15 +     - bind
16 +     - bind-chroot
17 +     - bind-utils