Extend system tests for @file filter syntax

This commit is contained in:
Gordian Schoenherr
2024-12-20 09:39:20 +09:00
parent 2467674fca
commit 8830354027
5 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/Release
Mirror [mirror36]: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/ stretch/updates successfully added.
You can run 'aptly mirror update mirror36' to download repository contents.

View File

@@ -0,0 +1,22 @@
Name: mirror36
Archive Root URL: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/
Distribution: stretch/updates
Components: main
Architectures: amd64, arm64, armel, armhf, i386
Download Sources: no
Download .udebs: no
Filter: nginx | Priority (required)
Filter With Deps: no
Last update: never
Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armel armhf i386
Codename: stretch
Components: updates/main updates/contrib updates/non-free
Description: Debian 9 Security Updates
Label: Debian-Security
Origin: Debian
Suite: oldoldstable
Version: 9

View File

@@ -0,0 +1,4 @@
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/Release
Mirror [mirror37]: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/ stretch/updates successfully added.
You can run 'aptly mirror update mirror37' to download repository contents.

View File

@@ -0,0 +1,22 @@
Name: mirror37
Archive Root URL: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/
Distribution: stretch/updates
Components: main
Architectures: amd64, arm64, armel, armhf, i386
Download Sources: no
Download .udebs: no
Filter: nginx | Priority (required)
Filter With Deps: no
Last update: never
Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armel armhf i386
Codename: stretch
Components: updates/main updates/contrib updates/non-free
Description: Debian 9 Security Updates
Label: Debian-Security
Origin: Debian
Suite: oldoldstable
Version: 9

View File

@@ -1,3 +1,4 @@
from pathlib import Path
import re
import os
@@ -489,3 +490,45 @@ class CreateMirror35Test(BaseTest):
def check(self):
self.check_output()
self.check_cmd_output("aptly mirror show mirror35", "mirror_show")
class CreateMirror36Test(BaseTest):
"""
create mirror: mirror with filter read from file
"""
filterFilePath = os.path.join(os.environ["HOME"], ".aptly-filter.tmp")
fixtureCmds = [f"bash -c \"echo -n 'nginx | Priority (required)' > {filterFilePath}\""]
runCmd = f"aptly mirror create -ignore-signatures -filter='@{filterFilePath}' mirror36 http://repo.aptly.info/system-tests/archive.debian.org/debian-security/ stretch/updates main"
def check(self):
def removeDates(s):
return re.sub(r"(Date|Valid-Until): [,0-9:+A-Za-z -]+\n", "", s)
self.check_output()
self.check_cmd_output("aptly mirror show mirror36",
"mirror_show", match_prepare=removeDates)
class CreateMirror37Test(BaseTest):
"""
create mirror: mirror with filter read from stdin
"""
aptly_testing_bin = Path(__file__).parent.parent.parent / "aptly.test"
# Hack: Normally the test system detects if runCmd is an aptly command and then
# substitutes the aptly_testing_bin path and deletes the last three lines of output.
# However, I need to run it in bash to control stdin, so I have to do it manually.
runCmd = [
"bash",
"-c",
f"echo -n 'nginx | Priority (required)' | {aptly_testing_bin} mirror create " +
"-ignore-signatures -filter='@-' mirror37 http://repo.aptly.info/system-tests/archive.debian.org/debian-security/ stretch/updates main " +
"| grep -vE '^(EXIT|PASS|coverage:)'"
]
def check(self):
def removeDates(s):
return re.sub(r"(Date|Valid-Until): [,0-9:+A-Za-z -]+\n", "", s)
self.check_output()
self.check_cmd_output("aptly mirror show mirror37",
"mirror_show", match_prepare=removeDates)