test_vm_persistance: add age keys

This commit is contained in:
lassulus
2024-01-19 14:24:40 +01:00
parent ce28342ba3
commit b98e15d6d7

View File

@@ -52,7 +52,9 @@ def test_run(
def test_vm_persistence( def test_vm_persistence(
monkeypatch: pytest.MonkeyPatch, monkeypatch: pytest.MonkeyPatch,
temporary_home: Path, temporary_home: Path,
age_keys: list["KeyPair"],
) -> None: ) -> None:
monkeypatch.setenv("SOPS_AGE_KEY", age_keys[0].privkey)
flake = generate_flake( flake = generate_flake(
temporary_home, temporary_home,
flake_template=CLAN_CORE / "templates" / "new-clan", flake_template=CLAN_CORE / "templates" / "new-clan",
@@ -90,7 +92,17 @@ def test_vm_persistence(
), ),
) )
monkeypatch.chdir(flake.path) monkeypatch.chdir(flake.path)
Cli().run(["vms", "run", "my_machine"]) cli = Cli()
cli.run(
[
"secrets",
"users",
"add",
"user1",
age_keys[0].pubkey,
]
)
cli.run(["vms", "run", "my_machine"])
test_file = ( test_file = (
vm_state_dir("_test_vm_persistence", str(flake.path), "my_machine") vm_state_dir("_test_vm_persistence", str(flake.path), "my_machine")
/ "var" / "var"