mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-26 13:47:40 +00:00
system tests: support fitureCmds and allow dirmgr to startup
- fixes a race condition, where dirmgr does not seem to be ready - imports secret key for signing if gpg2 is used
This commit is contained in:
@@ -55,6 +55,8 @@ class APITest(BaseTest):
|
|||||||
if os.path.exists(os.path.join(os.environ["HOME"], self.aptlyDir, "upload")):
|
if os.path.exists(os.path.join(os.environ["HOME"], self.aptlyDir, "upload")):
|
||||||
shutil.rmtree(os.path.join(os.environ["HOME"], self.aptlyDir, "upload"))
|
shutil.rmtree(os.path.join(os.environ["HOME"], self.aptlyDir, "upload"))
|
||||||
|
|
||||||
|
self.prepare_fixture()
|
||||||
|
|
||||||
def debug_output(self):
|
def debug_output(self):
|
||||||
return APITest.aptly_out.get_contents()
|
return APITest.aptly_out.get_contents()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -267,7 +267,7 @@ class BaseTest(object):
|
|||||||
self.webServerUrl = self.start_webserver(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)),
|
self.webServerUrl = self.start_webserver(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)),
|
||||||
self.fixtureWebServer))
|
self.fixtureWebServer))
|
||||||
|
|
||||||
if self.requiresGPG2:
|
if self.requiresGPG2 or self.gpgFinder.gpg2:
|
||||||
self.run_cmd([
|
self.run_cmd([
|
||||||
self.gpgFinder.gpg2, "--import",
|
self.gpgFinder.gpg2, "--import",
|
||||||
os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files") + "/aptly.sec"], expected_code=None)
|
os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files") + "/aptly.sec"], expected_code=None)
|
||||||
|
|||||||
+10
-1
@@ -2,6 +2,7 @@ import inspect
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import json
|
||||||
|
|
||||||
from api_lib import APITest
|
from api_lib import APITest
|
||||||
|
|
||||||
@@ -25,6 +26,12 @@ class GPGAPITestAddKey(APITest):
|
|||||||
"""
|
"""
|
||||||
requiresGPG2 = True
|
requiresGPG2 = True
|
||||||
|
|
||||||
|
fixtureCmds = [
|
||||||
|
"gpgconf --kill dirmngr",
|
||||||
|
"gpgconf --launch dirmngr",
|
||||||
|
"sleep 2"
|
||||||
|
]
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
with tempfile.NamedTemporaryFile(suffix=".pub") as keyring:
|
with tempfile.NamedTemporaryFile(suffix=".pub") as keyring:
|
||||||
gpgkeyid = "9E3E53F19C7DE460"
|
gpgkeyid = "9E3E53F19C7DE460"
|
||||||
@@ -33,7 +40,9 @@ class GPGAPITestAddKey(APITest):
|
|||||||
"Keyring": keyring.name,
|
"Keyring": keyring.name,
|
||||||
"GpgKeyID": gpgkeyid
|
"GpgKeyID": gpgkeyid
|
||||||
})
|
})
|
||||||
|
if resp.status_code != 200:
|
||||||
|
output = json.loads(resp.text)
|
||||||
|
print(f"{output}\n")
|
||||||
self.check_equal(resp.status_code, 200)
|
self.check_equal(resp.status_code, 200)
|
||||||
check_gpgkey_exists(gpgkeyid, keyring.name)
|
check_gpgkey_exists(gpgkeyid, keyring.name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user