From 4880f121edd6e64ce4d5d95b7ed9d8ddee3749f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Tue, 26 Jan 2021 15:59:29 +0100 Subject: [PATCH] Update test to not collide with systemd-resolved --- .../runtest.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Regression/bz669163-empty-search-option-in-etc-resolv-conf-causes/runtest.sh b/Regression/bz669163-empty-search-option-in-etc-resolv-conf-causes/runtest.sh index 7d78eee..e7bd815 100755 --- a/Regression/bz669163-empty-search-option-in-etc-resolv-conf-causes/runtest.sh +++ b/Regression/bz669163-empty-search-option-in-etc-resolv-conf-causes/runtest.sh @@ -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 < /etc/resolv.conf rlPhaseEnd rlJournalEnd