Update test to not collide with systemd-resolved

This commit is contained in:
Petr Menšík 2021-01-26 15:59:29 +01:00
commit 4880f121ed

View file

@ -26,8 +26,6 @@
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
RESOLV="/etc/resolv.conf"
@ -40,24 +38,25 @@ function testResolver() {
rlJournalStart
rlPhaseStartSetup
rlAssertRpm "$( rpm -qf /usr/bin/dig )"
cat /etc/resolv.conf > /tmp/a
rlFileBackup "$RESOLV"
rlFileBackup --clean "$RESOLV"
# resolv.conf can be symlink to systemd-resolved for example.
# Normal backup would not work well
rlRun "cat /etc/resolv.conf" 0 "SHOW INITIAL RESOLVER SETTINGS"
# I'll rely on this:
if ping -c 1 ns1.redhat.com; then
rlRun "NSFQDN=ns1.redhat.com"
rlRun "NSIP=$(host ns1.redhat.com | awk '{print $4}')"
elif ping -c 1 ns2.redhat.com; then
rlRun "NSFQDN=ns2.redhat.com"
rlRun "NSIP=$(host ns2.redhat.com | awk '{print $4}')"
elif ping -c 1 ns3.redhat.com; then
rlRun "NSFQDN=ns3.redhat.com"
rlRun "NSIP=$(host ns3.redhat.com | awk '{print $4}')"
else
rlRun "false" 0 "No nameserver reachable"
fi
rlLog "ns: $NSFQDN"
rlRun "NSIP=$(dig +short $NSFQDN)"
rlRun "rm -f $RESOLV" 0 "Remove original $RESOLV"
rlRun "cat /etc/resolv.conf" 0 "SHOW INITIAL RESOLVER SETTINGS"
rlLogInfo "Testcase 1"
cat > $RESOLV <<EOF
@ -85,6 +84,5 @@ EOF
testResolver
rlFileRestore
cat /tmp/a > /etc/resolv.conf
rlPhaseEnd
rlJournalEnd