← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~tushar5526/launchpad-buildd:update-tests-to-also-wait-check-for-snaps-to-seed-when-lxd-is-initialized into launchpad-buildd:master

 

Tushar Gupta has proposed merging ~tushar5526/launchpad-buildd:update-tests-to-also-wait-check-for-snaps-to-seed-when-lxd-is-initialized into launchpad-buildd:master.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~tushar5526/launchpad-buildd/+git/launchpad-buildd/+merge/476374
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~tushar5526/launchpad-buildd:update-tests-to-also-wait-check-for-snaps-to-seed-when-lxd-is-initialized into launchpad-buildd:master.
diff --git a/lpbuildd/target/tests/test_lxd.py b/lpbuildd/target/tests/test_lxd.py
index eb77d18..82d01bd 100644
--- a/lpbuildd/target/tests/test_lxd.py
+++ b/lpbuildd/target/tests/test_lxd.py
@@ -272,6 +272,7 @@ class TestLXD(TestCase):
         with open("/var/snap/lxd/common/lxd/server.key", "w"):
             pass
         processes_fixture = self.useFixture(FakeProcesses())
+        processes_fixture.add(lambda _: {}, name="sudo")
         tmp = self.useFixture(TempDir()).path
         source_image_path = os.path.join(tmp, "source.tar.gz")
         self.make_lxd_image(source_image_path)
@@ -281,8 +282,14 @@ class TestLXD(TestCase):
         image = mock.MagicMock()
         client.images.create.return_value = image
         LXD("1", "xenial", "amd64").create(source_image_path, "lxd")
-
-        self.assertEqual([], processes_fixture.procs)
+        self.assertThat(
+            [proc._args["args"] for proc in processes_fixture.procs],
+            MatchesListwise(
+                [
+                    Equals(["sudo", "snap", "wait", "system", "seed.loaded"]),
+                ]
+            ),
+        )
         client.images.create.assert_called_once_with(mock.ANY, wait=True)
         with io.BytesIO(client.images.create.call_args[0][0]) as f:
             with tarfile.open(fileobj=f) as tar:

Follow ups