fix tests

main
Jörg Thalheim 2 years ago
parent d5578bbeaf
commit c0d1ff9336
No known key found for this signature in database

@ -3,6 +3,6 @@
pytest_plugins = [
"command",
"root",
"systemd_vault",
"systemd_vaultd",
"tempdir",
]

@ -10,14 +10,14 @@ BIN: Optional[Path] = None
@pytest.fixture
def systemd_vault(project_root: Path) -> Path:
def systemd_vaultd(project_root: Path) -> Path:
global BIN
if BIN:
return BIN
bin = os.environ.get("SYSTEMD_VAULT_BIN")
bin = os.environ.get("SYSTEMD_VAULTD_BIN")
if bin:
BIN = Path(bin)
return BIN
run(["go", "build", str(project_root)])
BIN = project_root / "systemd-vault"
BIN = project_root / "systemd-vaultd"
return BIN

@ -29,7 +29,7 @@ def random_service(secrets_dir: Path) -> Service:
def test_socket_activation(
systemd_vault: Path, command: Command, tempdir: Path
systemd_vaultd: Path, command: Command, tempdir: Path
) -> None:
secrets_dir = tempdir / "secrets"
secrets_dir.mkdir()
@ -40,7 +40,7 @@ def test_socket_activation(
"systemd-socket-activate",
"--listen",
str(sock),
str(systemd_vault),
str(systemd_vaultd),
"-secrets",
str(secrets_dir),
"-sock",
@ -75,10 +75,10 @@ def test_socket_activation(
assert out.returncode == 0
def test_blocking_secret(systemd_vault: Path, command: Command, tempdir: Path) -> None:
def test_blocking_secret(systemd_vaultd: Path, command: Command, tempdir: Path) -> None:
secrets_dir = tempdir / "secrets"
sock = tempdir / "sock"
command.run([str(systemd_vault), "-secrets", str(secrets_dir), "-sock", str(sock)])
command.run([str(systemd_vaultd), "-secrets", str(secrets_dir), "-sock", str(sock)])
while not sock.exists():
time.sleep(0.1)

Loading…
Cancel
Save