def check(self): tap.plan(len(self.rules)) for i in self.rules: success = i.check(self) if success == 1: self.result["success"] += 1 else: self.result["fail"] += 1 tap.ok(success, i)
def run(self): """ """ tap.plan(len(self.testcases)) for t in self.testcases: tap.diag("Running '%s'" % t.testname) t.load() t.generate(self.pacman) t.run(self.pacman) tap.diag("==> Checking rules") tap.todo = t.expectfailure tap.subtest(lambda: t.check(), t.description)
def run(): tests = [ can_read_lower, redirect_lower_writes_existing, redirect_lower_writes_new, redirect_mkdir, redirect_readdir, redirect_stat, redirect_unlink, redirect_rmdir, ] tap.plan(len(tests)) for test in tests: run_test(test)
def run(self): """ """ for testcase in self.testcases: t = pmtest.pmtest(testcase, self.root, self.config) t.load() if t.skipall: tap.skip_all("skipping %s (%s)" % (t.description, t.skipall)) else: tap.plan(1) tap.diag("Running '%s'" % t.testname) t.generate(self.pacman) t.run(self.pacman) tap.diag("==> Checking rules") tap.todo = t.expectfailure tap.subtest(lambda: t.check(), t.description)
def run(self): """ """ for testcase in self.testcases: t = pmtest.pmtest(testcase, self.root, self.config) t.load() if t.skipall: tap.skip_all("skipping %s (%s)" % (t.description, t.skipall)) else: tap.plan(1) tap.diag("Running '%s'" % t.testname) t.generate(self.pacman) t.run(self.pacman) tap.diag("==> Checking rules") # When running under meson, we don't emit 'todo' in the plan and instead # handle expected failures in the test() objects. This really should be # fixed in meson: # https://github.com/mesonbuild/meson/issues/2923#issuecomment-614647076 tap.todo = (t.expectfailure and not 'RUNNING_UNDER_MESON' in os.environ) tap.subtest(lambda: t.check(), t.description)
def main() -> None: """ Test whether the retry behaviour in Vaultenv works as expected. We do this by: - Starting two Vaultenv processes (one for each version of the secrets file format) and letting them run for 5 seconds (during which they should retry) - Suspending the Vaultenv processes with the SIGSTOP signal - Setting up a Vault server process with the appropriate secrets - Resuming the Vaultenv processes with the SIGCONT signal - Checking whether the Vaultenv processes exited with code 0 and got the right secrets (by having them run /usr/bin/env) - Killing the Vault server We do this twice, once for version 1 of Vault's KV secret store API and once for version 2 of the API. The SIGSTOP/SIGCONT signals are necessary to prevent the Vaultenv processes from contacting the Vault server while it is up, but does not yet contain the right secrets (which causes a non-retryable error by design). """ v1_secrets_file = Path(os.environ["VAULT_SEEDS"]) v2_secrets_file = Path(os.environ["VAULT_SEEDS_V2"]) tap.plan(4) tap.diagnose("Starting Vaultenv processes") v1_handle = run_vaultenv(v1_secrets_file) v2_handle = run_vaultenv(v2_secrets_file) sleep(5) tap.diagnose("Pausing Vaultenv processes") v1_handle.send_signal(signal.SIGSTOP) v2_handle.send_signal(signal.SIGSTOP) tap.diagnose("Starting Vault server") vault_server = run_vault_server() sleep(5) tap.diagnose("Resuming Vaultenv processes") v1_handle.send_signal(signal.SIGCONT) v2_handle.send_signal(signal.SIGCONT) check_vaultenv_result(v1_handle, secrets_version=1, api_version=1) check_vaultenv_result(v2_handle, secrets_version=2, api_version=1) # We need to kill and restart the server or the kernel will accept the TCP # connections while the Vault server is paused. vault_server.terminate() vault_server.wait(timeout=5) tap.diagnose("Starting Vaultenv processes") v1_handle = run_vaultenv(v1_secrets_file) v2_handle = run_vaultenv(v2_secrets_file) sleep(5) tap.diagnose("Pausing Vaultenv processes") v1_handle.send_signal(signal.SIGSTOP) v2_handle.send_signal(signal.SIGSTOP) tap.diagnose("Starting Vault server") vault_server = run_vault_server() sleep(5) tap.diagnose("Resuming Vaultenv processes") v1_handle.send_signal(signal.SIGCONT) v2_handle.send_signal(signal.SIGCONT) check_vaultenv_result(v1_handle, secrets_version=1, api_version=2) check_vaultenv_result(v2_handle, secrets_version=2, api_version=2) tap.diagnose("Killing Vault server") vault_server.terminate() vault_server.wait(timeout=10)