@@ -6,6 +6,7 @@ from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
import candidate_release as candidate
|
||||
import candidate_runtime as runtime
|
||||
import production_cd as cd
|
||||
|
||||
BASE, A, B, OTHER = [c * 40 for c in 'abcd']
|
||||
@@ -66,6 +67,27 @@ class CandidateReleaseTest(unittest.TestCase):
|
||||
with self.assertRaisesRegex(cd.CDError, 'candidate must be on main'):
|
||||
candidate.verify_source(dict(plan, base=root, sha=live), repo)
|
||||
|
||||
def test_candidate_selects_only_the_configured_qa_password(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
config = root / 'qa.json'
|
||||
pgpass = root / 'qa.pgpass'
|
||||
cert = root / 'rds-ca.pem'
|
||||
for path in (config, pgpass, cert):
|
||||
path.touch(mode=0o600)
|
||||
config.write_text('{"host":"kg-qa-rds.test","port":15483,"database":"kg_qa_app","user":"kg_qa_app"}')
|
||||
application = 'kg-qa-rds.test:15483:kg_qa_app:kg_qa_app:app\\:example'
|
||||
integration = 'kg-qa-rds.test:15483:kg_qa_it:kg_qa_it:it-example'
|
||||
pgpass.write_text(f'{integration}\n{application}\n')
|
||||
url, ca = runtime.qa_database(config)
|
||||
self.assertEqual(ca, cert)
|
||||
self.assertIn('app%3Aexample@kg-qa-rds.test:15483/kg_qa_app', url)
|
||||
for rows in ((integration,), (application, application), (application, '*:15483:*:*:example'),
|
||||
(application, 'kg-qa-rds.test:15483:governance:governance:example')):
|
||||
pgpass.write_text('\n'.join(rows))
|
||||
with self.subTest(rows=rows), self.assertRaises(cd.CDError):
|
||||
runtime.qa_database(config)
|
||||
|
||||
def test_require_all_qa_reports_and_shared_regression(self):
|
||||
sources = {QA1: (self.report, self.result()), QA2: (self.report, self.result())}
|
||||
with self.assertRaisesRegex(cd.CDError, 'every requirement and the release task'):
|
||||
|
||||
Reference in New Issue
Block a user