From c86b888b0a753a0930e56cd5b6a3c0cce5d10247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Fri, 8 Nov 2024 17:42:00 +0100 Subject: [PATCH] add tests --- system/t04_mirror/CreateMirror34Test_gold | 6 ++++ system/t04_mirror/CreateMirror35Test_gold | 6 ++++ .../t04_mirror/CreateMirror35Test_mirror_show | 17 +++++++++ system/t04_mirror/create.py | 35 +++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 system/t04_mirror/CreateMirror34Test_gold create mode 100644 system/t04_mirror/CreateMirror35Test_gold create mode 100644 system/t04_mirror/CreateMirror35Test_mirror_show diff --git a/system/t04_mirror/CreateMirror34Test_gold b/system/t04_mirror/CreateMirror34Test_gold new file mode 100644 index 00000000..291d2058 --- /dev/null +++ b/system/t04_mirror/CreateMirror34Test_gold @@ -0,0 +1,6 @@ +Downloading: http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/Release +Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/Release +Retrying 0 http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/Release... +Download Error: http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/Release +Downloading: http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/InRelease +ERROR: unable to fetch mirror: no architectures found, please specify diff --git a/system/t04_mirror/CreateMirror35Test_gold b/system/t04_mirror/CreateMirror35Test_gold new file mode 100644 index 00000000..ae8e1c6d --- /dev/null +++ b/system/t04_mirror/CreateMirror35Test_gold @@ -0,0 +1,6 @@ +Downloading & parsing package files... +Applying filter... +Packages filtered: 4743 -> 81. +Building download queue... +Download queue: 81 items (3.00 GiB) + diff --git a/system/t04_mirror/CreateMirror35Test_mirror_show b/system/t04_mirror/CreateMirror35Test_mirror_show new file mode 100644 index 00000000..3ae1920a --- /dev/null +++ b/system/t04_mirror/CreateMirror35Test_mirror_show @@ -0,0 +1,17 @@ +Name: mirror35 +Archive Root URL: http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ +Distribution: ./ +Components: +Architectures: amd64 +Download Sources: no +Download .udebs: no +Filter: cuda-12-6 (= 12.6.2-1) +Filter With Deps: yes +Last update: never + +Information from release file: +Acquire-By-Hash: no +Architecture: x86_64 +Date: Mon, 04 Nov 2024 16:02:23 +0000 +Label: NVIDIA CUDA +Origin: NVIDIA diff --git a/system/t04_mirror/create.py b/system/t04_mirror/create.py index ef3d80f6..ecf3b6d4 100644 --- a/system/t04_mirror/create.py +++ b/system/t04_mirror/create.py @@ -454,3 +454,38 @@ class CreateMirror33Test(BaseTest): def check(self): self.check_output() self.check_cmd_output("aptly mirror show mirror33", "mirror_show") + + +class CreateMirror34Test(BaseTest): + """ + create mirror error: flat repo with filter but no architectures in InRelease file + """ + configOverride = {"max-tries": 1} + runCmd = "aptly mirror create -ignore-signatures -filter \"cuda-12-6 (= 12.6.2-1)\" -filter-with-deps mirror34 http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ ./" + + +class CreateMirror35Test(BaseTest): + """ + create mirror: flat repo with filter but no architectures in InRelease file + """ + configOverride = {"max-tries": 1} + fixtureCmds = [ + "aptly mirror create -architectures amd64 -ignore-signatures -filter \"cuda-12-6 (= 12.6.2-1)\" -filter-with-deps mirror35 " + "http://repo.aptly.info/system-tests/developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ ./", + ] + runCmd = "aptly mirror update -ignore-signatures mirror35" + + # the downloading of the actual packages will return 404 since they don't exist. ignore the errors, the test verifies proper count of filtered packages + + def outputMatchPrepare(self, s): + s = re.sub(r'Downloading: .*\n', '', s, flags=re.MULTILINE) + s = re.sub(r'Download Error: .*\n', '', s, flags=re.MULTILINE) + s = re.sub(r'Retrying .*\n', '', s, flags=re.MULTILINE) + s = re.sub(r'Error \(retrying\): .*\n', '', s, flags=re.MULTILINE) + s = re.sub(r'HTTP code 404 while fetching .*\n', '', s, flags=re.MULTILINE) + s = re.sub(r'ERROR: unable to update: .*\n', '', s, flags=re.MULTILINE) + return s + + def check(self): + self.check_output() + self.check_cmd_output("aptly mirror show mirror35", "mirror_show")