Files
lix/tests/functional2/commands/test_build/test_timeout.py
T
piegamesandeldritch horrors 567348a90c testlib: default nix fixture to also test all daemon protocols (2/3)
This commit enables the parametrization for "legacy-combined" protocol.
All failing tests with that have been either fixed or disabled. Notably:

- A couple of tests (e.g. involving builders) could be made to work with
a non-local store, but this would require some refactoring to testlib in
order to make certain configuration settings generic over local and
remote operations. We've disabled those for now, in order to make
progress
- The store tests all run locally only because of their nature
- The flakes tests also all run locally only because my energy for
fixing them is limited (and it's a *lot* of test failures, with probably
little overall benefit in terms of test coverage)

Change-Id: I56fa249a64f7c17c952f688ec89e9687f2a13f12
2026-06-28 18:17:57 +02:00

61 lines
1.7 KiB
Python

from testlib.fixtures.file_helper import with_files, CopyFile
from testlib.fixtures.nix import Nix
from testlib.utils import get_global_asset
import pytest
_files = {
"timeout.nix": CopyFile("assets/test_timeout/timeout.nix"),
"config.nix": get_global_asset("config.nix"),
}
@with_files(_files)
def test_timeout_timeout(nix: Nix):
res = (
nix.nix_build(["-Q", "timeout.nix", "-A", "infiniteLoop", "--timeout", "2"])
.run()
.expect(101 if not nix.uses_daemon else 1)
)
assert "timed out" in res.stderr_plain
@pytest.mark.no_daemon
@with_files(_files)
def test_timeout_max_log(nix: Nix):
res = (
nix.nix_build(["-Q", "timeout.nix", "-A", "infiniteLoop", "--max-build-log-size", "100"])
.run()
.expect(1)
)
assert "killed after writing more than 100 bytes of log output" in res.stderr_plain
@with_files(_files)
def test_timeout_silent(nix: Nix):
res = (
nix.nix_build(["timeout.nix", "-A", "silent", "--max-silent-time", "2"])
.run()
.expect(101 if not nix.uses_daemon else 1)
)
assert "file timed out after 2 seconds of silence" in res.stderr_plain
@with_files(_files)
def test_timeout_close_log(nix: Nix):
res = (
nix.nix_build(["timeout.nix", "-A", "closeLog"])
.run()
.expect(100 if not nix.uses_daemon else 1)
)
assert "failed due to signal 9 (Killed" in res.stderr_plain
@with_files(_files)
def test_timeout_nix3_silent(nix: Nix):
res = (
nix.nix(["build", "-f", "timeout.nix", "silent", "--max-silent-time", "2"], flake=True)
.run()
.expect(1)
)
assert "from .drv file timed out after 2 seconds of silence" in res.stderr_plain