Blame tests/p_ipa-server/6-dnsdetails.sh

James Hogarth 352003
#!/bin/bash
James Hogarth 352003
# Author: James Hogarth <james.hogarth@gmail.com>
James Hogarth 352003
#
James Hogarth 352003
James Hogarth abe41f
if (t_GetPkgRel basesystem | grep -qE 'el(6|7)')
James Hogarth acc301
then
James Hogarth acc301
James Hogarth 352003
# Need admin credentials
James Hogarth 352003
kdestroy &> /dev/null
James Hogarth 352003
James Hogarth 6c929b
klist 2>&1  | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null
James Hogarth 352003
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 19cf3b
expect -f - <
James Hogarth 352003
set send_human {.1 .3 1 .05 2}
James Hogarth 352003
spawn kinit admin
James Hogarth 352003
sleep 1
James Hogarth 352003
expect "Password for admin@C6IPA.LOCAL:"
James Hogarth 352003
send -h "p455w0rd\r"
James Hogarth 8030de
sleep 5
James Hogarth 352003
close
James Hogarth 352003
EOF
James Hogarth 352003
James Hogarth 352003
klist | grep "admin@C6IPA.LOCAL" &> /dev/null
James Hogarth 352003
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 175228
#There's an element of asynchronous behaviour we've seen here
James Hogarth 175228
#Sleeping after the IPA commands to give time for changes to 
James Hogarth 175228
#happen and named to notice through the bind-dyndb-ldap backend
James Hogarth 175228
James Hogarth 352003
#Add zone
James Hogarth 352003
t_Log "Running $0 - Adding a subdomain 'testzone'"
James Hogarth 0a8a3f
ipa dnszone-add --name-server=c6test.c6ipa.local. --admin-email=hostmaster.testzone.c6ipa.local. testzone.c6ipa.local &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 175228
sleep 5
James Hogarth 352003
James Hogarth 352003
#Can get SOA for new zone from DNS
James Hogarth 175228
t_Log "Running $0 - Can retrieve SOA for 'testzone'"
James Hogarth 175228
dig @localhost -t SOA testzone.c6ipa.local | grep "status: NOERROR" &> /dev/null
James Hogarth 175228
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Add record to standard zone
James Hogarth 352003
t_Log "Running $0 - Adding a testrecord to main domain"
James Hogarth 0a8a3f
ipa dnsrecord-add c6ipa.local testrecord --cname-hostname=c6test &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 175228
sleep 5
James Hogarth 352003
James Hogarth 352003
#Can get record from DNS
James Hogarth 352003
t_Log "Running $0 - Testing can retrieve record"
James Hogarth 352003
dig @localhost -t CNAME testrecord.c6ipa.local | grep "status: NOERROR" &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#Add record to new zone
James Hogarth 352003
t_Log "Running $0 - Adding a testrecord to subdomain"
James Hogarth 0a8a3f
ipa dnsrecord-add testzone.c6ipa.local testrecord --cname-hostname=c6test.c6ipa.local. &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 175228
sleep 5
James Hogarth 352003
James Hogarth 352003
#Can get record from DNS for new zone
James Hogarth 352003
t_Log "Running $0 - Testing can retrieve record from subdomain"
James Hogarth 352003
dig @localhost -t CNAME testrecord.testzone.c6ipa.local | grep "status: NOERROR" &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 352003
#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
James Hogarth 352003
t_Log "Running $0 - Changing configuration to use LDAP for forwarder configuration"
James Hogarth 352003
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/')"
James Hogarth 352003
sed -i '/forwarders/{N ; s/\n.*// }' /etc/named.conf
James Hogarth 352003
service named restart
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 0a8a3f
ipa dnsconfig-mod --forwarder=${forwarder} &> /dev/null
James Hogarth 352003
t_CheckExitStatus $?
James Hogarth 352003
James Hogarth 19cf3b
t_Log "Running $0 - Regression test of RHBA-2103-0739"
James Hogarth 352003
for i in {1..30}
James Hogarth 352003
do
James Hogarth 352003
service named reload &> /dev/null
James Hogarth 6c929b
service named status | grep running &> /dev/null || t_CheckExitStatus $?
James Hogarth 352003
sleep 1
James Hogarth 352003
done
James Hogarth 352003
James Hogarth acc301
else
James Hogarth acc301
    echo "Skipped on CentOS 5"
James Hogarth acc301
fi
James Hogarth acc301