Add publishing & repo include tests

This commit is contained in:
Andrey Smirnov
2017-07-26 00:31:27 +03:00
parent d137bcf8d4
commit ab20c2d329
6 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
openpgp: signing file 'Release'...
openpgp: clearsigning file 'Release'...
Local repo local-repo has been successfully published.
Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing.
Now you can add following line to apt sources:
deb http://your-server/ maverick main
deb-src http://your-server/ maverick main
Don't forget to add your GPG key to apt with apt-key.
You can also use `aptly serve` to publish your repositories over HTTP quickly.

View File

@@ -0,0 +1,15 @@
openpgp: Passphrase is required to unlock private key "Aptly Tester (don't use it) <test@aptly.info>"
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
openpgp: signing file 'Release'...
openpgp: clearsigning file 'Release'...
Local repo local-repo has been successfully published.
Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing.
Now you can add following line to apt sources:
deb http://your-server/ maverick main
deb-src http://your-server/ maverick main
Don't forget to add your GPG key to apt with apt-key.
You can also use `aptly serve` to publish your repositories over HTTP quickly.

View File

@@ -710,3 +710,49 @@ class PublishRepo29Test(BaseTest):
]
runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo"
gold_processor = BaseTest.expand_environ
class PublishRepo30Test(BaseTest):
"""
publish repo: default (internal PGP implementation)
"""
fixtureCmds = [
"aptly repo create local-repo",
"aptly repo add local-repo ${files}",
]
runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo"
gold_processor = BaseTest.expand_environ
configOverride = {"gpgProvider": "internal"}
def check(self):
super(PublishRepo30Test, self).check()
# verify signatures
self.run_cmd(["gpg", "--no-auto-check-trustdb", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly.pub"),
"--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/InRelease')])
self.run_cmd(["gpg", "--no-auto-check-trustdb", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly.pub"),
"--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release.gpg'),
os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release')])
class PublishRepo31Test(BaseTest):
"""
publish repo: sign with passphrase (internal PGP implementation)
"""
fixtureCmds = [
"aptly repo create local-repo",
"aptly repo add local-repo ${files}",
]
runCmd = "aptly publish repo -keyring=${files}/aptly_passphrase.pub -secret-keyring=${files}/aptly_passphrase.sec -passphrase=verysecret -distribution=maverick local-repo"
gold_processor = BaseTest.expand_environ
configOverride = {"gpgProvider": "internal"}
def check(self):
super(PublishRepo31Test, self).check()
# verify signatures
self.run_cmd(["gpg", "--no-auto-check-trustdb", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly_passphrase.pub"),
"--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/InRelease')])
self.run_cmd(["gpg", "--no-auto-check-trustdb", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly_passphrase.pub"),
"--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release.gpg'),
os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release')])

View File

@@ -0,0 +1,5 @@
openpgp: DSA key ID 21DBB89C16DB3E6D
openpgp: 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

View File

@@ -0,0 +1,4 @@
[!] unable to process file hardlink_0.2.1_amd64.changes: failed to verify signature: openpgp: invalid signature: hash tag doesn't match
[!] Some files were skipped due to errors:
/01/hardlink_0.2.1_amd64.changes
ERROR: some files failed to be added

View File

@@ -468,3 +468,51 @@ class IncludeRepo19Test(BaseTest):
def outputMatchPrepare(_, s):
return changesRemove(_, gpgRemove(_, s))
class IncludeRepo20Test(BaseTest):
"""
include packages to local repo: .changes file from directory (internal PGP implementation)
"""
fixtureCmds = [
"aptly repo create unstable",
]
runCmd = "aptly repo include -no-remove-files -keyring=${files}/aptly.pub ${changes}"
outputMatchPrepare = gpgRemove
configOverride = {"gpgProvider": "internal"}
class IncludeRepo21Test(BaseTest):
"""
include packages to local repo: wrong signature (internal PGP implementation)
"""
fixtureCmds = [
"aptly repo create unstable",
]
runCmd = "aptly repo include -keyring=${files}/aptly.pub "
expectedCode = 1
configOverride = {"gpgProvider": "internal"}
def outputMatchPrepare(self, s):
return gpgRemove(self, tempDirRemove(self, s))
def prepare(self):
super(IncludeRepo21Test, self).prepare()
self.tempSrcDir = tempfile.mkdtemp()
shutil.copytree(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), os.path.join(self.tempSrcDir, "01"))
with open(os.path.join(self.tempSrcDir, "01", "hardlink_0.2.1_amd64.changes"), "r+") as f:
contents = f.read()
f.seek(0, 0)
f.write(contents.replace('Julian', 'Andrey'))
f.truncate()
self.runCmd += self.tempSrcDir
def check(self):
try:
super(IncludeRepo21Test, self).check()
finally:
shutil.rmtree(self.tempSrcDir)