Working log streaming
This commit is contained in:
@@ -72,7 +72,7 @@ class BuildVmTask(BaseTask):
|
|||||||
vm_path = f"{''.join(proc.stdout[0])}/bin/run-nixos-vm"
|
vm_path = f"{''.join(proc.stdout[0])}/bin/run-nixos-vm"
|
||||||
self.log.debug(f"vm_path: {vm_path}")
|
self.log.debug(f"vm_path: {vm_path}")
|
||||||
|
|
||||||
#self.run_cmd(vm_path)
|
self.run_cmd(vm_path)
|
||||||
self.finished = True
|
self.finished = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.failed = True
|
self.failed = True
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class BaseTask(threading.Thread):
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
# shell=True,
|
# shell=True,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
)
|
)
|
||||||
self.procs.append(CmdState(p))
|
self.procs.append(CmdState(p))
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from pathlib import Path
|
|||||||
import pytest
|
import pytest
|
||||||
from api import TestClient
|
from api import TestClient
|
||||||
|
|
||||||
|
|
||||||
# @pytest.mark.impure
|
# @pytest.mark.impure
|
||||||
# def test_inspect(api: TestClient, test_flake_with_core: Path) -> None:
|
# def test_inspect(api: TestClient, test_flake_with_core: Path) -> None:
|
||||||
# response = api.post(
|
# response = api.post(
|
||||||
@@ -43,7 +42,8 @@ def test_create(api: TestClient, test_flake_with_core: Path) -> None:
|
|||||||
response = api.get(f"/api/vms/{uuid}/logs")
|
response = api.get(f"/api/vms/{uuid}/logs")
|
||||||
print("=========LOGS==========")
|
print("=========LOGS==========")
|
||||||
for line in response.stream:
|
for line in response.stream:
|
||||||
print(f"line: {line}")
|
|
||||||
assert line != b"", "Failed to get vm logs"
|
assert line != b"", "Failed to get vm logs"
|
||||||
|
print(line.decode("utf-8"), end="")
|
||||||
|
print("=========END LOGS==========")
|
||||||
assert response.status_code == 200, "Failed to get vm logs"
|
assert response.status_code == 200, "Failed to get vm logs"
|
||||||
|
time.sleep(10)
|
||||||
Reference in New Issue
Block a user