test: local-drafter flow tests run as a normal user under a root CI
tests / unittest (push) Successful in 28s
tests / unittest (push) Successful in 28s
CI runs the suite as root, where the drafter refuses to run pi without an unprivileged user, so every local flow test exited 1 there and passed on a workstation. The flow tests now patch geteuid to a normal user; the root refusal keeps its own test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ef68f12fb
commit
c798d8fd8f
1 file changed
+6
@@ -30,6 +30,12 @@ class LocalSetup:
|
|||||||
self.env.update({"INPUT_DRAFTER": "local", "INPUT_LOCAL_URL": URL,
|
self.env.update({"INPUT_DRAFTER": "local", "INPUT_LOCAL_URL": URL,
|
||||||
"LOCAL_MODEL_API_KEY": KEY, "DOCS_REVIEW_PI_BIN": str(self.fake_pi)})
|
"LOCAL_MODEL_API_KEY": KEY, "DOCS_REVIEW_PI_BIN": str(self.fake_pi)})
|
||||||
self.argv_file = tmp / "pi-argv"
|
self.argv_file = tmp / "pi-argv"
|
||||||
|
# CI runs the suite as root, where the drafter refuses to run pi without an
|
||||||
|
# unprivileged user. These tests are about the flow, so they run as a normal user;
|
||||||
|
# the root refusal has its own test, which patches geteuid back to 0.
|
||||||
|
not_root = mock.patch.object(local.os, "geteuid", return_value=1000)
|
||||||
|
not_root.start()
|
||||||
|
self.addCleanup(not_root.stop)
|
||||||
|
|
||||||
def pi(self, **config):
|
def pi(self, **config):
|
||||||
config = {"sentinel": str(self.sentinel), "env_file": str(self.env_file),
|
config = {"sentinel": str(self.sentinel), "env_file": str(self.env_file),
|
||||||
|
|||||||
Reference in new issue
Block a user