← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:snap-charm-filter-uploads into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:snap-charm-filter-uploads into launchpad:master.

Commit message:
Fix selection of snap/charm files to upload to the store

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/408680

I lost the filter for files ending with ".snap" or ".charm" in a recent refactoring (https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/408582).
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:snap-charm-filter-uploads into launchpad:master.
diff --git a/lib/lp/charms/model/charmhubclient.py b/lib/lp/charms/model/charmhubclient.py
index 33ea281..1ac2f6c 100644
--- a/lib/lp/charms/model/charmhubclient.py
+++ b/lib/lp/charms/model/charmhubclient.py
@@ -210,16 +210,6 @@ class CharmhubClient:
             timeline_action.finish()
 
     @classmethod
-    def upload(cls, build):
-        """See `ICharmhubClient`."""
-        assert build.recipe.can_upload_to_store
-        for _, lfa, _ in build.getFiles():
-            if not lfa.filename.endswith(".charm"):
-                continue
-            upload_id = cls.uploadFile(lfa)
-            return cls._push(build, upload_id)
-
-    @classmethod
     def checkStatus(cls, build, status_url):
         """See `ICharmhubClient`."""
         status_url = urlappend(
diff --git a/lib/lp/charms/model/charmrecipebuildjob.py b/lib/lp/charms/model/charmrecipebuildjob.py
index cfe86a6..a0f7993 100644
--- a/lib/lp/charms/model/charmrecipebuildjob.py
+++ b/lib/lp/charms/model/charmrecipebuildjob.py
@@ -323,13 +323,16 @@ class CharmhubUploadJob(CharmRecipeBuildJobDerived):
         client = getUtility(ICharmhubClient)
         try:
             try:
-                lfa = next((row[1] for row in self.build.getFiles()), None)
-                if lfa is None:
+                charm_lfa = next(
+                    (lfa for _, lfa, _ in self.build.getFiles()
+                     if lfa.filename.endswith(".charm")),
+                    None)
+                if charm_lfa is None:
                     # Nothing to do.
                     self.error_message = None
                     return
                 if "upload_id" not in self.store_metadata:
-                    self.upload_id = client.uploadFile(lfa)
+                    self.upload_id = client.uploadFile(charm_lfa)
                     # We made progress, so reset attempt_count.
                     self.attempt_count = 1
                 if "status_url" not in self.store_metadata:
diff --git a/lib/lp/charms/tests/test_charmrecipebuildjob.py b/lib/lp/charms/tests/test_charmrecipebuildjob.py
index d8c1e86..69865b1 100644
--- a/lib/lp/charms/tests/test_charmrecipebuildjob.py
+++ b/lib/lp/charms/tests/test_charmrecipebuildjob.py
@@ -84,6 +84,19 @@ class FakeCharmhubClient:
         self.release = FakeMethod()
 
 
+class FileUploaded(MatchesListwise):
+
+    def __init__(self, filename):
+        super().__init__([
+            MatchesListwise([
+                MatchesListwise([
+                    MatchesStructure.byEquality(filename=filename),
+                    ]),
+                MatchesDict({}),
+                ]),
+            ])
+
+
 class TestCharmRecipeBuildJob(TestCaseWithFactory):
 
     layer = DatabaseFunctionalLayer
@@ -130,12 +143,15 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
             repr(job))
 
     def makeCharmRecipeBuild(self, **kwargs):
-        # Make a build with a builder, a file, and a webhook.
+        # Make a build with a builder, some files, and a webhook.
         build = self.factory.makeCharmRecipeBuild(
             builder=self.factory.makeBuilder(), **kwargs)
         build.updateStatus(BuildStatus.FULLYBUILT)
+        irrelevant_lfa = self.factory.makeLibraryFileAlias(
+            filename="000-irrelevant.txt", content=b"irrelevant file")
+        self.factory.makeCharmFile(build=build, library_file=irrelevant_lfa)
         charm_lfa = self.factory.makeLibraryFileAlias(
-            filename="test-charm.charm", content="dummy charm content")
+            filename="test-charm.charm", content=b"dummy charm content")
         self.factory.makeCharmFile(build=build, library_file=charm_lfa)
         self.factory.makeWebhook(
             target=build.recipe, event_types=["charm-recipe:build:0.1"])
@@ -180,7 +196,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         # revision.
         logger = self.useFixture(FakeLogger())
         build = self.makeCharmRecipeBuild()
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -190,7 +205,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([((build, 1), {})], client.push.calls)
         self.assertEqual(
             [((build, self.status_url), {})], client.checkStatus.calls)
@@ -205,7 +221,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         # A failed run sets the store upload status to FAILED.
         logger = self.useFixture(FakeLogger())
         build = self.makeCharmRecipeBuild()
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -213,7 +228,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertEqual([], client.release.calls)
@@ -234,7 +250,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         build = self.makeCharmRecipeBuild(
             requester=requester_team, name="test-charm", owner=requester_team,
             project=project)
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -244,7 +259,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertEqual([], client.release.calls)
@@ -287,7 +303,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         # retried.
         logger = self.useFixture(FakeLogger())
         build = self.makeCharmRecipeBuild()
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -296,7 +311,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertEqual([], client.release.calls)
@@ -316,7 +332,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         client.checkStatus.result = 1
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([((build, 1), {})], client.push.calls)
         self.assertEqual(
             [((build, self.status_url), {})], client.checkStatus.calls)
@@ -339,7 +356,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         build = self.makeCharmRecipeBuild(
             requester=requester_team, name="test-charm", owner=requester_team,
             project=project)
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -348,7 +364,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertEqual([], client.release.calls)
@@ -392,7 +409,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         # charm schedules itself to be retried.
         logger = self.useFixture(FakeLogger())
         build = self.makeCharmRecipeBuild()
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -402,7 +418,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([((build, 2), {})], client.push.calls)
         self.assertEqual(
             [((build, self.status_url), {})], client.checkStatus.calls)
@@ -445,7 +462,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         build = self.makeCharmRecipeBuild(
             requester=requester_team, name="test-charm", owner=requester_team,
             project=project)
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -456,7 +472,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([((build, 2), {})], client.push.calls)
         self.assertEqual(
             [((build, self.status_url), {})], client.checkStatus.calls)
@@ -498,7 +515,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         # channels does so.
         logger = self.useFixture(FakeLogger())
         build = self.makeCharmRecipeBuild(store_channels=["stable", "edge"])
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -508,7 +524,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([((build, 1), {})], client.push.calls)
         self.assertEqual(
             [((build, self.status_url), {})], client.checkStatus.calls)
@@ -530,7 +547,6 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         build = self.makeCharmRecipeBuild(
             requester=requester_team, name="test-charm", owner=requester_team,
             project=project, store_channels=["stable", "edge"])
-        charm_lfa = build.getFiles()[0][1]
         self.assertContentEqual([], build.store_upload_jobs)
         job = CharmhubUploadJob.create(build)
         client = FakeCharmhubClient()
@@ -541,7 +557,8 @@ class TestCharmhubUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ICharmhubClient))
         with dbuser(config.ICharmhubUploadJobSource.dbuser):
             JobRunner([job]).runAll()
-        self.assertEqual([((charm_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-charm.charm"))
         self.assertEqual([((build, 1), {})], client.push.calls)
         self.assertEqual(
             [((build, self.status_url), {})], client.checkStatus.calls)
diff --git a/lib/lp/snappy/model/snapbuildjob.py b/lib/lp/snappy/model/snapbuildjob.py
index 8e79973..dbf43e1 100644
--- a/lib/lp/snappy/model/snapbuildjob.py
+++ b/lib/lp/snappy/model/snapbuildjob.py
@@ -345,13 +345,16 @@ class SnapStoreUploadJob(SnapBuildJobDerived):
         client = getUtility(ISnapStoreClient)
         try:
             try:
-                lfa = next((row[1] for row in self.snapbuild.getFiles()), None)
-                if lfa is None:
+                snap_lfa = next(
+                    (lfa for _, lfa, _ in self.snapbuild.getFiles()
+                     if lfa.filename.endswith(".snap")),
+                    None)
+                if snap_lfa is None:
                     # Nothing to do.
                     self.error_message = None
                     return
                 if "upload_id" not in self.store_metadata:
-                    self.upload_id = client.uploadFile(lfa)
+                    self.upload_id = client.uploadFile(snap_lfa)
                     # We made progress, so reset attempt_count.
                     self.attempt_count = 1
                 if "status_url" not in self.store_metadata:
diff --git a/lib/lp/snappy/tests/test_snapbuildjob.py b/lib/lp/snappy/tests/test_snapbuildjob.py
index 1c1f316..68eef98 100644
--- a/lib/lp/snappy/tests/test_snapbuildjob.py
+++ b/lib/lp/snappy/tests/test_snapbuildjob.py
@@ -79,6 +79,19 @@ class FakeSnapStoreClient:
         self.listChannels = FakeMethod(result=[])
 
 
+class FileUploaded(MatchesListwise):
+
+    def __init__(self, filename):
+        super().__init__([
+            MatchesListwise([
+                MatchesListwise([
+                    MatchesStructure.byEquality(filename=filename),
+                    ]),
+                MatchesDict({}),
+                ]),
+            ])
+
+
 class TestSnapBuildJob(TestCaseWithFactory):
 
     layer = DatabaseFunctionalLayer
@@ -125,6 +138,10 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         snapbuild = self.factory.makeSnapBuild(
             builder=self.factory.makeBuilder(), **kwargs)
         snapbuild.updateStatus(BuildStatus.FULLYBUILT)
+        irrelevant_lfa = self.factory.makeLibraryFileAlias(
+            filename="000-irrelevant.txt", content=b"irrelevant file")
+        self.factory.makeSnapFile(
+            snapbuild=snapbuild, libraryfile=irrelevant_lfa)
         snap_lfa = self.factory.makeLibraryFileAlias(
             filename="test-snap.snap", content=b"dummy snap content")
         self.factory.makeSnapFile(snapbuild=snapbuild, libraryfile=snap_lfa)
@@ -169,7 +186,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         # and revision.
         logger = self.useFixture(FakeLogger())
         snapbuild = self.makeSnapBuild()
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -179,7 +195,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 1), {})], client.push.calls)
         self.assertEqual([((self.status_url,), {})], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -196,7 +213,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         # A failed run sets the store upload status to FAILED.
         logger = self.useFixture(FakeLogger())
         snapbuild = self.makeSnapBuild()
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -204,7 +220,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -225,7 +242,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
             owner=requester, name="requester-team", members=[requester])
         snapbuild = self.makeSnapBuild(
             requester=requester_team, name="test-snap", owner=requester_team)
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -235,7 +251,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 1), {})], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -277,7 +294,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         # retried.
         logger = self.useFixture(FakeLogger())
         snapbuild = self.makeSnapBuild()
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -286,7 +302,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -308,7 +325,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         client.checkStatus.result = (self.store_url, 1)
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 1), {})], client.push.calls)
         self.assertEqual([((self.status_url,), {})], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -331,7 +349,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
             owner=requester, name="requester-team", members=[requester])
         snapbuild = self.makeSnapBuild(
             requester=requester_team, name="test-snap", owner=requester_team)
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -340,7 +357,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 1), {})], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -387,7 +405,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
             owner=requester, name="requester-team", members=[requester])
         snapbuild = self.makeSnapBuild(
             requester=requester_team, name="test-snap", owner=requester_team)
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -396,7 +413,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([], client.push.calls)
         self.assertEqual([], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -441,7 +459,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         # package schedules itself to be retried.
         logger = self.useFixture(FakeLogger())
         snapbuild = self.makeSnapBuild()
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -451,7 +468,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 2), {})], client.push.calls)
         self.assertEqual([((self.status_url,), {})], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -495,7 +513,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
             owner=requester, name="requester-team", members=[requester])
         snapbuild = self.makeSnapBuild(
             requester=requester_team, name="test-snap", owner=requester_team)
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -509,7 +526,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 2), {})], client.push.calls)
         self.assertEqual([((self.status_url,), {})], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -555,7 +573,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         # URL or revision.
         logger = self.useFixture(FakeLogger())
         snapbuild = self.makeSnapBuild()
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -565,7 +582,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 1), {})], client.push.calls)
         self.assertEqual([((self.status_url,), {})], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)
@@ -583,7 +601,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         # channels does so.
         logger = self.useFixture(FakeLogger())
         snapbuild = self.makeSnapBuild(store_channels=["stable", "edge"])
-        snap_lfa = snapbuild.getFiles()[0][1]
         self.assertContentEqual([], snapbuild.store_upload_jobs)
         job = SnapStoreUploadJob.create(snapbuild)
         client = FakeSnapStoreClient()
@@ -593,7 +610,8 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
         self.useFixture(ZopeUtilityFixture(client, ISnapStoreClient))
         with dbuser(config.ISnapStoreUploadJobSource.dbuser):
             run_isolated_jobs([job])
-        self.assertEqual([((snap_lfa,), {})], client.uploadFile.calls)
+        self.assertThat(
+            client.uploadFile.calls, FileUploaded("test-snap.snap"))
         self.assertEqual([((snapbuild, 1), {})], client.push.calls)
         self.assertEqual([((self.status_url,), {})], client.checkStatus.calls)
         self.assertContentEqual([job], snapbuild.store_upload_jobs)