From e27efd4035878a8ba4b72fd5c2405896d34a6aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 3 Oct 2023 17:18:36 +0200 Subject: [PATCH] add test for vm cli --- pkgs/clan-cli/tests/test_vms_cli.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pkgs/clan-cli/tests/test_vms_cli.py diff --git a/pkgs/clan-cli/tests/test_vms_cli.py b/pkgs/clan-cli/tests/test_vms_cli.py new file mode 100644 index 000000000..8b365d2a4 --- /dev/null +++ b/pkgs/clan-cli/tests/test_vms_cli.py @@ -0,0 +1,22 @@ +import os +from pathlib import Path + +import pytest +from cli import Cli + +no_kvm = not os.path.exists("/dev/kvm") + + +@pytest.mark.impure +def test_inspect(test_flake_with_core: Path, capsys: pytest.CaptureFixture) -> None: + cli = Cli() + cli.run(["vms", "inspect", "vm1"]) + out = capsys.readouterr() # empty the buffer + assert "Cores" in out.out + + +@pytest.mark.skipif(no_kvm, reason="Requires KVM") +@pytest.mark.impure +def test_create(test_flake_with_core: Path) -> None: + cli = Cli() + cli.run(["vms", "create", "vm1"])