]> git.ipfire.org Git - pbs.git/commitdiff
tests: build: Create a case where one job fails
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Oct 2022 15:40:50 +0000 (15:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Oct 2022 15:40:50 +0000 (15:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/build.py

index 61e9c54357980fef9254046786423308af932f16..48c97c4adf9a3407bb8f7cd618b71785710c0334 100755 (executable)
@@ -169,6 +169,34 @@ class BuildTestCase(test.TestCase):
                                log=log,
                        )
 
+       async def test_fail(self):
+               """
+                       This test creates a build and pretends a job failed
+               """
+               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)
+
+               # Pick the first job
+               job = build.jobs[0]
+
+               # Upload the log
+               log = await self._create_upload(
+                       self.source_path("tests/data/beep-1.3-2.ip3.x86_64.log"),
+               )
+
+               # Pretend that the job has failed
+               await job.finished(
+                       success=False,
+                       log=log,
+               )
+
        async def test_log(self):
                """
                        This test creates a build and tries to access the log