From 2ddd381f4ad1a077469ebdb0db22fdad7ebaffb2 Mon Sep 17 00:00:00 2001 From: rmynar <64528205+rmynar@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:04:56 +0100 Subject: [PATCH] Fix test_positive_mismatched_satellite_fqdn (#16796) don't use nameservers to simulate mismatched hostname (cherry picked from commit 50806c858180615cee44855abac3421633056cee) --- tests/foreman/destructive/test_installer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/foreman/destructive/test_installer.py b/tests/foreman/destructive/test_installer.py index 8c61633fc53..46056ad83a5 100644 --- a/tests/foreman/destructive/test_installer.py +++ b/tests/foreman/destructive/test_installer.py @@ -28,10 +28,15 @@ def set_random_fqdn(target_sat): shortname = gen_string('alpha') new_domain = gen_domain() target_sat.execute( - f'echo "search {new_domain}" >> /etc/resolv.conf; hostnamectl set-hostname {shortname}' + 'mv -f /etc/resolv.conf /etc/resolv.conf.bak; ' + f'echo "search {new_domain}" > /etc/resolv.conf; ' + f'hostnamectl set-hostname {shortname}' ) yield shortname, new_domain - target_sat.execute(f'hostnamectl set-hostname {target_sat.hostname}') + target_sat.execute( + 'mv -f /etc/resolv.conf.bak /etc/resolv.conf; ' + f'hostnamectl set-hostname {target_sat.hostname}' + ) def test_installer_sat_pub_directory_accessibility(target_sat):