Skip to content

Commit

Permalink
Try to block the internet connection after PONR
Browse files Browse the repository at this point in the history
  • Loading branch information
kokesak committed Sep 27, 2024
1 parent e2d07de commit 91c7f0c
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ def test_error_after_ponr(convert2rhel, shell):
This test destroys the machine so neither reboot nor any checks after conversion are called
"""
assert shell("yum install dnsmasq -y").returncode == 0
with convert2rhel(
"-y --serverurl {} --username {} --password {} --debug".format(
TEST_VARS["RHSM_SERVER_URL"],
TEST_VARS["RHSM_SCA_USERNAME"],
TEST_VARS["RHSM_SCA_PASSWORD"],
)
) as c2r:
# Wait until "Replace system packages" task to cause the failure
# This will prevent yum restoring the original configuration
c2r.expect("CONVERT_SYSTEM_PACKAGES has succeeded")
# Wait until Point of no return appears. Then block all the internet connection
c2r.expect_exact("WARNING - The tool allows rollback of any action until this point.")
c2r.expect_exact("Convert: Replace system packages")

assert shell('echo "proxy=localhost" >> /etc/yum.conf').returncode == 0
# Everything is resolved to localhost
with open("/etc/dnsmasq.conf", "a") as f:
f.write("address=/#/127.0.0.1")

with open("/etc/resolv.conf", "w") as f:
f.write("nameserver 127.0.0.1")

assert shell("systemctl enable dnsmasq && systemctl restart dnsmasq").returncode == 0

c2r.expect("WARNING - The conversion process failed")
c2r.expect(
Expand All @@ -29,4 +37,4 @@ def test_error_after_ponr(convert2rhel, shell):
"It is strongly recommended to store the Convert2RHEL logs for later investigation, and restore the system from a backup"
)

assert c2r.exitstatus == 1
assert c2r.exitstatus == 2

0 comments on commit 91c7f0c

Please sign in to comment.