Skip to content

Commit

Permalink
test: Add test for Machine.clone_container() API
Browse files Browse the repository at this point in the history
Check that we can clone a container and that it is isolated from the
host.
  • Loading branch information
martinpitt committed Oct 11, 2024
1 parent 54fb0c7 commit 4b84996
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/browser/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if [ "$PLAN" = "main" ]; then
TestAccounts
TestBonding
TestBridge
TestConnection.testCloneContainer
TestFirewall
TestJournal
TestKdump
Expand Down
19 changes: 19 additions & 0 deletions test/verify/check-connection
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,25 @@ UnixPath=/run/cockpit/session
self.assertGreater(len(bridges), 0)
self.assertIn('sudo', bridge_names)

@testlib.skipOstree("OSTree doesn't have networkd")
@testlib.nondestructive
def testCloneContainer(self):
m = self.machine
m2 = m.clone_container()

# the two now have independent file systems
m.write("/tmp/stamp-host", "host")
m.write("/run/stamp-host", "host")
m2.write("/tmp/stamp-container", "container")
m2.write("/run/stamp-container", "container")
m.execute("! ls /tmp/stamp-container; ! ls /run/stamp-container")
m2.execute("! ls /tmp/stamp-host; ! ls /run/stamp-host")

# and independent systemd
m.execute("systemctl stop systemd-hostnamed.service")
m2.execute("systemctl start systemd-hostnamed.service")
m.execute("! systemctl status systemd-hostnamed.service")


class TestReverseProxy(testlib.MachineCase):

Expand Down

0 comments on commit 4b84996

Please sign in to comment.