Files
lix/tests/functional2/cli/test_store_ping.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

37 lines
1.1 KiB
Python

import pytest
from testlib.fixtures.nix import Nix, NixDaemon
pytestmark = pytest.mark.no_daemon
@pytest.fixture(autouse=True)
def setup(nix: Nix):
nix.settings.add_xp_feature("nix-command")
def test_ping(nix: Nix):
info = nix.nix(["store", "ping"]).run().ok().stderr_plain
assert "Store URL: local" in info
def test_ping_json(nix: Nix):
info = nix.nix(["store", "ping", "--json"]).run().ok().json()
assert info["url"] == "local"
def test_ping_daemon(nix: Nix, daemon: NixDaemon):
version = nix.nix(["daemon", "--version"]).run().ok().stdout_plain
version = version.splitlines()[0].split()[-1]
with daemon(nix) as inner:
info = nix.nix(["store", "ping"]).run().ok().stderr_plain
assert f"Version: {version}" in info
info = inner.nix(["store", "ping", "--json"]).run().ok().json()
assert info["url"] == inner.settings.store
assert info["version"] == version
def test_ping_bad_store(nix: Nix):
nix.settings.store = f"unix:{nix.env.dirs.home}"
error = nix.nix(["store", "ping"]).run().expect(1).stderr_plain
assert "could not connect" in error