Add CI tests using the standard test interface
This commit is contained in:
parent
5dd3b801ff
commit
1f0b377b18
64
tests/Basic-sanity-test/Makefile
Normal file
64
tests/Basic-sanity-test/Makefile
Normal file
@ -0,0 +1,64 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/avahi/Sanity/Basic-sanity-test
|
||||
# Description: Tests basic functionality of avahi.
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2010 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 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/CoreOS/avahi/Sanity/Basic-sanity-test
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE named.conf zonefile
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -e runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Tests basic functionality of avahi." >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 10m" >> $(METADATA)
|
||||
@echo "RunFor: avahi" >> $(METADATA)
|
||||
@echo "Requires: avahi avahi-tools bind bind-chroot bind-utils" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Releases: -RedHatEnterpriseLinux3 -RedHatEnterpriseLinux4" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
15
tests/Basic-sanity-test/PURPOSE
Normal file
15
tests/Basic-sanity-test/PURPOSE
Normal file
@ -0,0 +1,15 @@
|
||||
PURPOSE of /CoreOS/avahi/Sanity/Basic-sanity-test
|
||||
Description: Tests basic functionality of avahi.
|
||||
Author: Martin Cermak <mcermak@redhat.com>
|
||||
|
||||
My objective was to write a very basic sanity test for avahi.
|
||||
As I'm the avahi newbie, I browsed avahi.org, experimented
|
||||
a little with RHEL avahi packages and pinged Lennart, which
|
||||
did not respond.
|
||||
|
||||
My result is a simple test for the avahi domain name resolver.
|
||||
It requires the avahi-daemon running. As the RHTS/Beaker is/will
|
||||
shortly be a closed system without the possibility to reach the
|
||||
outside network, this test contains its own nameserver.
|
||||
|
||||
|
11
tests/Basic-sanity-test/named.conf
Normal file
11
tests/Basic-sanity-test/named.conf
Normal file
@ -0,0 +1,11 @@
|
||||
options {
|
||||
directory "/var/named";
|
||||
allow-query { any; };
|
||||
};
|
||||
|
||||
zone "<DOMAIN>" IN {
|
||||
type master;
|
||||
file "<DOMAIN>.zone";
|
||||
allow-update { none; };
|
||||
};
|
||||
|
96
tests/Basic-sanity-test/runtest.sh
Executable file
96
tests/Basic-sanity-test/runtest.sh
Executable file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/avahi/Sanity/Basic-sanity-test
|
||||
# Description: Tests basic functionality of avahi.
|
||||
# Author: Martin Cermak <mcermak@redhat.com>
|
||||
# Author: Tomas Dolezal <todoleza@redhat.com> - rhel7 updates
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 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 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/bin/rhts-environment.sh
|
||||
. /usr/lib/beakerlib/beakerlib.sh
|
||||
|
||||
TEMPSTR=$(date +%c%N | md5sum | awk '{print $1}' | cut -c -8)
|
||||
ORIGPWD=$(pwd)
|
||||
|
||||
IP1='127.0.0.1'
|
||||
IP2='::1'
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm 'avahi'
|
||||
rlAssertRpm 'avahi-tools'
|
||||
|
||||
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
|
||||
ROOTDIR="" #using non-chroot
|
||||
rlFileBackup /etc/named.conf /etc/resolv.conf
|
||||
rlFileBackup --clean /var/named/
|
||||
cat $ORIGPWD/named.conf > /etc/named.conf
|
||||
|
||||
rlRun "TDOMAIN=$TEMPSTR.cz"
|
||||
rlRun "TZONEFILE=$ROOTDIR/var/named/$TDOMAIN.zone"
|
||||
|
||||
# set up /etc/named.conf
|
||||
rlRun "sed -i \"s/<DOMAIN>/$TDOMAIN/g\" /etc/named.conf"
|
||||
|
||||
# set up zonefile
|
||||
rlRun "cp $ORIGPWD/zonefile $TZONEFILE"
|
||||
rlRun "chmod a+r $TZONEFILE"
|
||||
rlRun "sed -i \"s/<DOMAIN>/$TDOMAIN/g\" $TZONEFILE"
|
||||
rlRun "sed -i \"s/<IP1>/$IP1/g\" $TZONEFILE"
|
||||
rlRun "sed -i \"s/<IP2>/$IP2/g\" $TZONEFILE"
|
||||
rlRun "sed -i \"s/<SERIAL>/$(date +%N)/g\" $TZONEFILE"
|
||||
|
||||
rlServiceStart named #using non-chroot
|
||||
|
||||
# set default resolver
|
||||
rlRun "echo nameserver 127.0.0.1 > /etc/resolv.conf"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
# check bind
|
||||
rlRun "dig @localhost server1.$TDOMAIN +short | grep $IP1"
|
||||
rlRun "dig AAAA @localhost server2.$TDOMAIN +short | grep $IP2"
|
||||
|
||||
# turn on avahi or restart it with new resolv.conf
|
||||
rlServiceStart "avahi-daemon"
|
||||
|
||||
# the test itself...
|
||||
rlRun "avahi-resolve -4n server1.$TDOMAIN | grep '127.0.0.1'" 0 "Test the IPv4 avahi DN resolver."
|
||||
rlRun "avahi-resolve -6n server2.$TDOMAIN | grep '::1'" 0 "Test the IPv6 avahi DN resolver."
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlFileRestore
|
||||
rlServiceStart avahi-daemon
|
||||
rlServiceRestore named avahi-daemon
|
||||
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
23
tests/Basic-sanity-test/zonefile
Normal file
23
tests/Basic-sanity-test/zonefile
Normal file
@ -0,0 +1,23 @@
|
||||
$ORIGIN <DOMAIN>.
|
||||
$TTL 86400
|
||||
@ IN SOA dns1.<DOMAIN>. hostmaster.<DOMAIN>. (
|
||||
<SERIAL> ; serial
|
||||
21600 ; refresh after 6 hours
|
||||
3600 ; retry after 1 hour
|
||||
604800 ; expire after 1 week
|
||||
86400 ) ; minimum TTL of 1 day
|
||||
|
||||
IN NS dns1.<DOMAIN>.
|
||||
IN NS dns2.<DOMAIN>.
|
||||
|
||||
IN MX 10 mail.<DOMAIN>.
|
||||
IN MX 20 mail2.<DOMAIN>.
|
||||
|
||||
IN A <IP1>
|
||||
|
||||
server1 IN A <IP1>
|
||||
server2 IN AAAA <IP2>
|
||||
|
||||
dns1 IN A <IP1>
|
||||
dns2 IN A <IP1>
|
||||
|
16
tests/tests.yml
Normal file
16
tests/tests.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
# Tests that run in classic context
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-beakerlib
|
||||
tags:
|
||||
- classic
|
||||
tests:
|
||||
- Basic-sanity-test
|
||||
required_packages:
|
||||
- avahi
|
||||
- avahi-tools
|
||||
- bind
|
||||
- bind-chroot
|
||||
- bind-utils
|
Loading…
Reference in New Issue
Block a user