mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
First pack of system tests for aptly repo include. #71
This commit is contained in:
@@ -154,6 +154,7 @@ class BaseTest(object):
|
||||
if not hasattr(command, "__iter__"):
|
||||
params = {
|
||||
'files': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"),
|
||||
'changes': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"),
|
||||
'udebs': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "udebs"),
|
||||
'testfiles': os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__),
|
||||
'aptlyroot': os.path.join(os.environ["HOME"], ".aptly"),
|
||||
|
||||
5
system/t09_repo/IncludeRepo1Test_gold
Normal file
5
system/t09_repo/IncludeRepo1Test_gold
Normal file
@@ -0,0 +1,5 @@
|
||||
gpgv: Signature made Sun Mar 15 20:36:44 2015 MSK using DSA key ID 16DB3E6D
|
||||
gpgv: Good signature from "Aptly Tester (don't use it) <test@aptly.info>"
|
||||
Loading repository unstable for changes file hardlink_0.2.1_amd64.changes...
|
||||
[+] hardlink_0.2.1_source added
|
||||
[+] hardlink_0.2.1_amd64 added
|
||||
8
system/t09_repo/IncludeRepo1Test_repo_show
Normal file
8
system/t09_repo/IncludeRepo1Test_repo_show
Normal file
@@ -0,0 +1,8 @@
|
||||
Name: unstable
|
||||
Comment:
|
||||
Default Distribution:
|
||||
Default Component: main
|
||||
Number of packages: 2
|
||||
Packages:
|
||||
hardlink_0.2.1_amd64
|
||||
hardlink_0.2.1_source
|
||||
5
system/t09_repo/IncludeRepo2Test_gold
Normal file
5
system/t09_repo/IncludeRepo2Test_gold
Normal file
@@ -0,0 +1,5 @@
|
||||
gpgv: DSA key ID 16DB3E6D
|
||||
gpgv: Good signature from "Aptly Tester (don't use it) <test@aptly.info>"
|
||||
Loading repository my-unstable for changes file hardlink_0.2.1_amd64.changes...
|
||||
[+] hardlink_0.2.1_source added
|
||||
[+] hardlink_0.2.1_amd64 added
|
||||
11
system/t09_repo/IncludeRepo2Test_repo_show
Normal file
11
system/t09_repo/IncludeRepo2Test_repo_show
Normal file
@@ -0,0 +1,11 @@
|
||||
Name: my-unstable
|
||||
Comment:
|
||||
Default Distribution:
|
||||
Default Component: main
|
||||
Number of packages: 5
|
||||
Packages:
|
||||
hardlink_0.2.1_amd64
|
||||
libboost-program-options-dev_1.49.0.1_i386
|
||||
hardlink_0.2.1_source
|
||||
pyspi_0.6.1-1.3_source
|
||||
pyspi_0.6.1-1.4_source
|
||||
1
system/t09_repo/IncludeRepo3Test_gold
Normal file
1
system/t09_repo/IncludeRepo3Test_gold
Normal file
@@ -0,0 +1 @@
|
||||
ERROR: error parsing -repo template: template: repo:1: unexpected "}" in operand; missing space?
|
||||
5
system/t09_repo/IncludeRepo4Test_gold
Normal file
5
system/t09_repo/IncludeRepo4Test_gold
Normal file
@@ -0,0 +1,5 @@
|
||||
Loading repository unstable for changes file hardlink_0.2.1_amd64.changes...
|
||||
[!] unable to process file hardlink_0.2.1_amd64.changes: local repo with name unstable not found
|
||||
[!] Some files were skipped due to errors:
|
||||
/hardlink_0.2.1_amd64.changes
|
||||
ERROR: some files failed to be added
|
||||
@@ -14,3 +14,4 @@ from .remove import *
|
||||
from .show import *
|
||||
from .rename import *
|
||||
from .search import *
|
||||
from .include import *
|
||||
|
||||
71
system/t09_repo/include.py
Normal file
71
system/t09_repo/include.py
Normal file
@@ -0,0 +1,71 @@
|
||||
import tempfile
|
||||
import shutil
|
||||
import os
|
||||
import inspect
|
||||
import re
|
||||
from lib import BaseTest
|
||||
|
||||
gpgRemove = lambda _, s: re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE)
|
||||
changesRemove = lambda _, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "")
|
||||
|
||||
|
||||
class IncludeRepo1Test(BaseTest):
|
||||
"""
|
||||
incldue packages to local repo: .changes file from directory
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create unstable",
|
||||
]
|
||||
runCmd = "aptly repo include -no-remove-files -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = gpgRemove
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly repo show -with-packages unstable", "repo_show")
|
||||
|
||||
# check pool
|
||||
self.check_exists('pool//20/81/hardlink_0.2.1_amd64.deb')
|
||||
self.check_exists('pool/4e/fc/hardlink_0.2.1.dsc')
|
||||
self.check_exists('pool/8e/2c/hardlink_0.2.1.tar.gz')
|
||||
|
||||
|
||||
class IncludeRepo2Test(BaseTest):
|
||||
"""
|
||||
incldue packages to local repo: .changes file from file + custom repo
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create my-unstable",
|
||||
"aptly repo add my-unstable ${files}",
|
||||
]
|
||||
runCmd = "aptly repo include -no-remove-files -keyring=${files}/aptly.pub -repo=my-{{.Distribution}} ${changes}/hardlink_0.2.1_amd64.changes"
|
||||
outputMatchPrepare = gpgRemove
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly repo show -with-packages my-unstable", "repo_show")
|
||||
|
||||
# check pool
|
||||
self.check_exists('pool//20/81/hardlink_0.2.1_amd64.deb')
|
||||
self.check_exists('pool/4e/fc/hardlink_0.2.1.dsc')
|
||||
self.check_exists('pool/8e/2c/hardlink_0.2.1.tar.gz')
|
||||
|
||||
|
||||
class IncludeRepo3Test(BaseTest):
|
||||
"""
|
||||
incldue packages to local repo: broken repo flag
|
||||
"""
|
||||
fixtureCmds = [
|
||||
]
|
||||
runCmd = "aptly repo include -no-remove-files -keyring=${files}/aptly.pub -repo=my-{{.Distribution} ${changes}"
|
||||
expectedCode = 1
|
||||
|
||||
|
||||
class IncludeRepo4Test(BaseTest):
|
||||
"""
|
||||
incldue packages to local repo: missing repo
|
||||
"""
|
||||
fixtureCmds = [
|
||||
]
|
||||
runCmd = "aptly repo include -no-remove-files -ignore-signatures -keyring=${files}/aptly.pub ${changes}"
|
||||
outputMatchPrepare = changesRemove
|
||||
expectedCode = 1
|
||||
Reference in New Issue
Block a user