]> git.ipfire.org Git - pbs.git/commitdiff
tests: Implement recent changes
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Mar 2023 22:43:24 +0000 (22:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Mar 2023 22:43:24 +0000 (22:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/repository.py
tests/build.py
tests/distro.py
tests/test.py

index 785d540a7e86c3ec64e14d7de5a7f904eefb1225..4c29418fbb520af6682a12457c332eb4ff47d938 100644 (file)
@@ -717,6 +717,9 @@ class Repository(base.DataObject):
                                # Local path
                                path = self.local_path()
 
+                               # Ensure the parent directory exists
+                               os.makedirs(os.path.dirname(path), exist_ok=True)
+
                                # Move the old data to the temporary space
                                try:
                                        shutil.move(path, bin)
index 45541b65951a524320d3494de0b4c9c3049aef8e..680c5d215b90aceb68a1a51d3e0de7722fc6a35e 100755 (executable)
@@ -206,10 +206,10 @@ class BuildTestCase(test.TestCase):
                path = self.source_path("tests/data/beep-1.3-2.ip3.x86_64.pfm")
 
                # Upload a package
-               package = await self._create_upload(path)
+               #package = await self._create_upload(path)
 
                # Upload the log
-               log = await self._create_upload(
+               logfile = await self._create_upload(
                        self.source_path("tests/data/beep-1.3-2.ip3.x86_64.log"),
                )
 
@@ -218,7 +218,7 @@ class BuildTestCase(test.TestCase):
                        await job.finished(
                                success=True,
                                #packages=[package],
-                               log=log,
+                               logfile=logfile,
                        )
 
        async def test_fail(self):
@@ -239,14 +239,14 @@ class BuildTestCase(test.TestCase):
                job = build.jobs[0]
 
                # Upload the log
-               log = await self._create_upload(
+               logfile = 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,
+                       logfile=logfile,
                )
 
        async def test_abort(self):
@@ -300,14 +300,14 @@ class BuildTestCase(test.TestCase):
                        await job.open_log()
 
                # Upload the log
-               log = await self._create_upload(
+               logfile = 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,
+                       logfile=logfile,
                )
 
                # Check if we have a log
index b98aeebd41c6c0d5445d75e3998b46316b3d090e..6c2734af629b5f4bb62192c314860b9775089204 100755 (executable)
@@ -15,14 +15,15 @@ class DistroTestCase(test.TestCase):
                        Tests whether we can create a distribution
                """
                with self.db.transaction():
-                       distro = self.backend.distros.create("Random Test Distribution 1", "test1")
+                       distro = self.backend.distros.create("Random Test Distribution 2", "test", 2)
 
                # Check that we got the correct type back
                self.assertIsInstance(distro, distribution.Distribution)
 
                # Check if the values got set correct
-               self.assertEqual(distro.name, "Random Test Distribution 1")
-               self.assertEqual(distro.tag, "test1")
+               self.assertEqual(distro.name, "Random Test Distribution 2")
+               self.assertEqual(distro.slug, "test-2")
+               self.assertEqual(distro.tag, "test2")
 
        def test_default(self):
                """
index 393d8cbec6ae81e26985273dfbc60518906335a3..da971b1b70655d28931c913084d84b455bf7dd4b 100644 (file)
@@ -129,7 +129,7 @@ class TestCase(unittest.IsolatedAsyncioTestCase):
                self.user.quota = 104857600 # 100 MiB
 
                # Create a distribution
-               self.distro = self.backend.distros.create("Default Test Distribution", "test1")
+               self.distro = self.backend.distros.create("Default Test Distribution", "test", 1)
 
                # Enable this distribution for aarch64 & x86_64
                self.distro.arches = ["aarch64", "x86_64"]