Skip to content

Commit

Permalink
tests: extend simple_proxyvm test
Browse files Browse the repository at this point in the history
Add netvm reconnect to the test. This is mostly to test if DNS
forwarding gets properly updated on dynamic network attach too.

Suggested at
QubesOS/qubes-core-agent-linux#505 (comment)

(cherry picked from commit 14b5612)
  • Loading branch information
marmarek committed Jul 6, 2024
1 parent 1165bc3 commit b8349df
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion qubes/tests/integ/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def test_000_simple_networking(self):
self.assertEqual(self.run_cmd(self.testvm1, self.ping_ip), 0)
self.assertEqual(self.run_cmd(self.testvm1, self.ping_name), 0)


def test_010_simple_proxyvm(self):
'''
:type self: qubes.tests.SystemTestCase | VMNetworkingMixin
Expand All @@ -188,6 +187,23 @@ def test_010_simple_proxyvm(self):
self.assertEqual(self.run_cmd(self.testvm1, self.ping_name), 0,
"Ping by IP from AppVM failed")

self.proxy.netvm = None
self.loop.run_until_complete(self.testnetvm.shutdown(wait=True))
# change IP to test if all info is updated, especially DNS redirect
self.test_ip = '192.168.45.123'
self.ping_ip = self.ping_cmd.format(target=self.test_ip)
self.configure_netvm()
self.proxy.netvm = self.testnetvm
self.loop.run_until_complete(asyncio.sleep(1))

self.assertEqual(self.run_cmd(self.proxy, self.ping_ip), 0,
"Ping by IP from ProxyVM failed (after switch)")
self.assertEqual(self.run_cmd(self.proxy, self.ping_name), 0,
"Ping by name from ProxyVM failed (after switch)")
self.assertEqual(self.run_cmd(self.testvm1, self.ping_ip), 0,
"Ping by IP from AppVM failed (after switch)")
self.assertEqual(self.run_cmd(self.testvm1, self.ping_name), 0,
"Ping by IP from AppVM failed (after switch)")

@qubes.tests.expectedFailureIfTemplate('debian-7')
@unittest.skipUnless(spawn.find_executable('xdotool'),
Expand Down

0 comments on commit b8349df

Please sign in to comment.