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 = [ pytest_plugins = [
"command", "command",
"root", "root",
"systemd_vault", "systemd_vaultd",
"tempdir", "tempdir",
] ]

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

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

Loading…
Cancel
Save