]> git.ipfire.org Git - pbs.git/commitdiff
tests: Test aborting build jobs
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Oct 2022 15:55:41 +0000 (15:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Oct 2022 15:55:41 +0000 (15:55 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/build.py

index 48c97c4adf9a3407bb8f7cd618b71785710c0334..414d238cf41e4d00b9e084b9d54da3fe4355890e 100755 (executable)
@@ -197,6 +197,27 @@ class BuildTestCase(test.TestCase):
                        log=log,
                )
 
+       async def test_abort(self):
+               """
+                       This test tries to abort a job
+               """
+               path = self.source_path("tests/data/beep-1.3-2.ip3.src.pfm")
+
+               # Create the build
+               with self.db.transaction():
+                       build = await self._create_build(path, owner=self.user)
+
+               # Assign all jobs to the default builder
+               for job in build.jobs:
+                       job.assign(self.builder)
+
+               # Abort all jobs
+               for job in build.jobs:
+                       await job.abort(self.user)
+
+                       self.assertTrue(job.is_aborted())
+                       self.assertIsNotNone(job.aborted_at)
+
        async def test_log(self):
                """
                        This test creates a build and tries to access the log