Use a non-root fixture operator in root CI containers
ABSDEV Framework CI / framework-ci (push) Successful in 20s

This commit is contained in:
Mark Gregory
2026-11-28 10:07:28 +00:00
parent eac09534c7
commit b0dda75809
2 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -82,9 +82,16 @@ class ApprovalStoreTests(unittest.TestCase):
self.identifier = self.approval["approval_id"]
self.uid = os.geteuid()
if self.uid == 0:
self.uid = 1000
identity = patch("core.operator_approval.geteuid", return_value=self.uid)
identity.start()
self.addCleanup(identity.stop)
self.key = os.urandom(32)
self.grants = [
OperatorGrant(os.geteuid(), "operator", operation, self.base["site"],
OperatorGrant(self.uid, "operator", operation, self.base["site"],
self.base["revision"], self.now + timedelta(days=2))
for operation in ("issue", "execute")
]
@@ -481,7 +488,7 @@ class ApprovalStoreTests(unittest.TestCase):
self.assertFalse(self.store.approval_path(self.identifier).exists())
def test_unrecognised_os_identity_denies_issuance(self):
other_account = [replace(grant, uid=os.geteuid() + 1) for grant in self.grants]
other_account = [replace(grant, uid=self.uid + 1) for grant in self.grants]
self.store.operator_policy = OperatorApprovalPolicy(other_account, sealing_key=self.key)
with self.assertRaisesRegex(ApprovalStoreError, "not authorised"):
self.save()