mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Use different keyring in system tests.
This commit is contained in:
BIN
system/files/aptly.pub
Normal file
BIN
system/files/aptly.pub
Normal file
Binary file not shown.
BIN
system/files/aptly.sec
Normal file
BIN
system/files/aptly.sec
Normal file
Binary file not shown.
13
system/gpg-gen-key
Normal file
13
system/gpg-gen-key
Normal file
@@ -0,0 +1,13 @@
|
||||
Key-Type: DSA
|
||||
Key-Length: 1024
|
||||
Subkey-Type: ELG-E
|
||||
Subkey-Length: 1024
|
||||
Name-Real: Aptly Tester
|
||||
Name-Comment: don't use it
|
||||
Name-Email: test@aptly.info
|
||||
Expire-Date: 0
|
||||
%pubring aptly.pub
|
||||
%secring aptly.sec
|
||||
# Do a commit here, so that we can later print "done" :-)
|
||||
%commit
|
||||
%echo done
|
||||
@@ -129,9 +129,6 @@ class BaseTest(object):
|
||||
os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "flat.key")])
|
||||
|
||||
if hasattr(self, "fixtureCmds"):
|
||||
if self.fixtureWebServer:
|
||||
params = {'url': self.webServerUrl}
|
||||
self.fixtureCmds = [string.Template(cmd).substitute(params) for cmd in self.fixtureCmds]
|
||||
for cmd in self.fixtureCmds:
|
||||
self.run_cmd(cmd)
|
||||
|
||||
@@ -141,6 +138,12 @@ class BaseTest(object):
|
||||
def run_cmd(self, command, expected_code=0):
|
||||
try:
|
||||
if not hasattr(command, "__iter__"):
|
||||
params = {'files': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files")}
|
||||
if self.fixtureWebServer:
|
||||
params['url'] = self.webServerUrl
|
||||
|
||||
command = string.Template(command).substitute(params)
|
||||
|
||||
command = shlex.split(command)
|
||||
environ = os.environ.copy()
|
||||
environ["LC_ALL"] = "C"
|
||||
|
||||
@@ -51,7 +51,7 @@ class DropSnapshot4Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap1"
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1"
|
||||
]
|
||||
runCmd = "aptly snapshot drop snap1"
|
||||
expectedCode = 1
|
||||
@@ -65,7 +65,7 @@ class DropSnapshot5Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap1"
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1"
|
||||
]
|
||||
runCmd = "aptly snapshot drop --force snap1"
|
||||
expectedCode = 1
|
||||
@@ -88,7 +88,7 @@ class DropSnapshot7Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap1",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1",
|
||||
"aptly publish drop maverick",
|
||||
]
|
||||
runCmd = "aptly snapshot drop snap1"
|
||||
|
||||
@@ -9,7 +9,7 @@ class PublishDrop1Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap1",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1",
|
||||
]
|
||||
runCmd = "aptly publish drop maverick"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
@@ -29,7 +29,7 @@ class PublishDrop2Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap1 ppa/smira",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1 ppa/smira",
|
||||
]
|
||||
runCmd = "aptly publish drop maverick ppa/smira"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
@@ -17,7 +17,7 @@ class PublishList2Test(BaseTest):
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
"aptly snapshot merge snap2 snap1",
|
||||
"aptly publish snapshot snap1",
|
||||
"aptly -architectures=amd64 publish snapshot -distribution=wheezy -component=contrib snap2 ppa/smira",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1",
|
||||
"aptly -architectures=amd64 publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=contrib snap2 ppa/smira",
|
||||
]
|
||||
runCmd = "aptly publish list"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import hashlib
|
||||
import inspect
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
@@ -16,7 +17,7 @@ class PublishSnapshot1Test(BaseTest):
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly publish snapshot snap1"
|
||||
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
@@ -39,8 +40,10 @@ class PublishSnapshot1Test(BaseTest):
|
||||
self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor)
|
||||
|
||||
# verify signatures
|
||||
self.run_cmd(["gpg", "--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/InRelease')])
|
||||
self.run_cmd(["gpg", "--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release.gpg'),
|
||||
self.run_cmd(["gpg", "--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", "--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')])
|
||||
|
||||
# verify sums
|
||||
@@ -83,7 +86,7 @@ class PublishSnapshot2Test(BaseTest):
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap2 from mirror gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly publish snapshot -distribution=squeeze snap2"
|
||||
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap2"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
@@ -115,7 +118,7 @@ class PublishSnapshot3Test(BaseTest):
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap3 from mirror gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly publish snapshot -distribution=squeeze -component=contrib snap3"
|
||||
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze -component=contrib snap3"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
@@ -147,7 +150,7 @@ class PublishSnapshot4Test(BaseTest):
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap4 from mirror gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly -architectures=i386 publish snapshot -distribution=squeeze snap4"
|
||||
runCmd = "aptly -architectures=i386 publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap4"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
@@ -179,7 +182,7 @@ class PublishSnapshot5Test(BaseTest):
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap5 from mirror gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly publish snapshot -distribution=squeeze snap5 ppa/smira"
|
||||
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap5 ppa/smira"
|
||||
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
@@ -221,7 +224,7 @@ class PublishSnapshot7Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap7 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap7",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap7",
|
||||
]
|
||||
runCmd = "aptly publish snapshot snap7"
|
||||
expectedCode = 1
|
||||
@@ -235,7 +238,7 @@ class PublishSnapshot8Test(BaseTest):
|
||||
fixturePool = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap8 from mirror gnuplot-maverick",
|
||||
"aptly publish snapshot snap8 ./ppa",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap8 ./ppa",
|
||||
]
|
||||
runCmd = "aptly publish snapshot snap8 ppa"
|
||||
expectedCode = 1
|
||||
|
||||
Reference in New Issue
Block a user