require effective config for slots ttl
This commit is contained in:
parent
8fdf2d5e5b
commit
a4f642402b
2 changed files with 32 additions and 14 deletions
|
|
@ -7,7 +7,13 @@ from datetime import UTC, datetime, timedelta
|
|||
import pytest
|
||||
|
||||
from nix_builder_autoscaler import cli
|
||||
from nix_builder_autoscaler.cli import _parse_args, _print_slots, _print_status_summary, _slot_ttl
|
||||
from nix_builder_autoscaler.cli import (
|
||||
_get_effective_config,
|
||||
_parse_args,
|
||||
_print_slots,
|
||||
_print_status_summary,
|
||||
_slot_ttl,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_args_without_command_prints_help_and_exits_zero(
|
||||
|
|
@ -149,3 +155,15 @@ def test_print_slots_includes_ttl_column(capsys: pytest.CaptureFixture[str]) ->
|
|||
out = capsys.readouterr().out
|
||||
assert "ttl" in out
|
||||
assert "slot001" in out
|
||||
|
||||
|
||||
def test_get_effective_config_raises_on_non_2xx(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
def _fake_request(socket_path: str, method: str, path: str, body=None): # noqa: ANN001
|
||||
assert socket_path == "/tmp/sock"
|
||||
assert method == "GET"
|
||||
assert path == "/v1/config/effective"
|
||||
return 404, {"error": "not found"}
|
||||
|
||||
monkeypatch.setattr(cli, "_uds_request", _fake_request)
|
||||
with pytest.raises(RuntimeError, match="failed to fetch effective config"):
|
||||
_get_effective_config("/tmp/sock")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue