mirror of
https://seed.radicle.dev/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE.git
synced 2026-11-15 16:00:39 +08:00
test case: no RADICLE_NATIVE_CI set in environment
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+26
-4
@@ -84,6 +84,27 @@ class Suite:
|
||||
self.assert_triggered(resps[0])
|
||||
self.assert_success(resps[1])
|
||||
|
||||
def test_without_config_env_var(self):
|
||||
git = Git(os.path.join(self.tmp, "no-config"))
|
||||
git.init()
|
||||
git.write("README.md", "README")
|
||||
native = NativeYaml("echo hello world")
|
||||
debug(f"native.yaml: {native.yaml()}")
|
||||
git.write(".radicle/native.yaml", native.yaml())
|
||||
git.commit("first commit")
|
||||
commit = git.head()
|
||||
self.rad.init(git)
|
||||
rid = self.rad.rid(git)
|
||||
trigger = Trigger(rid, commit)
|
||||
ci = NativeCI(self.rad, self.config)
|
||||
ci.without_config()
|
||||
exit, resps = ci.run(trigger)
|
||||
debug(f"exit: {exit}")
|
||||
debug(f"responses: {resps}")
|
||||
assert exit != 0
|
||||
assert len(resps) == 0
|
||||
# FIXME: check stderr that env var RADICLE_NATIVE_CI is mentioned
|
||||
|
||||
def test_command_fails(self):
|
||||
exit, resps = self._test_case("cmd-fails", "false")
|
||||
assert exit != 0
|
||||
@@ -230,14 +251,15 @@ class NativeCI:
|
||||
def __init__(self, rad, config):
|
||||
self.rad_home = rad.rad_home
|
||||
self.config = config.path
|
||||
|
||||
def env(self):
|
||||
return {
|
||||
self.env = {
|
||||
"RAD_HOME": self.rad_home,
|
||||
"RADICLE_NATIVE_CI": self.config,
|
||||
"RADICLE_NATIVE_CI_LOG": "debug",
|
||||
}
|
||||
|
||||
def without_config(self):
|
||||
del self.env["RADICLE_NATIVE_CI"]
|
||||
|
||||
def run(self, request):
|
||||
p = run(
|
||||
[
|
||||
@@ -246,7 +268,7 @@ class NativeCI:
|
||||
"-q",
|
||||
],
|
||||
input=request.json(),
|
||||
env=self.env(),
|
||||
env=dict(self.env),
|
||||
may_fail=True,
|
||||
)
|
||||
return p.returncode, [
|
||||
|
||||
Reference in New Issue
Block a user