mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Extend system tests for @file filter syntax
This commit is contained in:
4
system/t04_mirror/CreateMirror36Test_gold
Normal file
4
system/t04_mirror/CreateMirror36Test_gold
Normal 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.
|
||||
22
system/t04_mirror/CreateMirror36Test_mirror_show
Normal file
22
system/t04_mirror/CreateMirror36Test_mirror_show
Normal 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
|
||||
4
system/t04_mirror/CreateMirror37Test_gold
Normal file
4
system/t04_mirror/CreateMirror37Test_gold
Normal 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.
|
||||
22
system/t04_mirror/CreateMirror37Test_mirror_show
Normal file
22
system/t04_mirror/CreateMirror37Test_mirror_show
Normal 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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user