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
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
from testlib.fixtures.nix import Nix
|
|
from testlib.fixtures.git import Git
|
|
from testlib.fixtures.file_helper import with_files, File
|
|
from testlib.utils import get_global_asset_pack
|
|
from testlib.environ import environ
|
|
from pathlib import Path
|
|
from .common import simple_flake
|
|
import pytest
|
|
|
|
pytestmark = pytest.mark.no_daemon
|
|
|
|
system = environ.get("system")
|
|
files = simple_flake() | {
|
|
"b-low": simple_flake()
|
|
| {
|
|
"flake.nix": File(f"""{{
|
|
outputs = inputs: rec {{
|
|
packages.{system} = rec {{
|
|
default =
|
|
assert builtins.readFile ./message == "all good\n";
|
|
assert builtins.readFile (inputs.self + "/message") == "all good\n";
|
|
import ./simple.nix;
|
|
}};
|
|
}};
|
|
}}"""),
|
|
"message": File("all good\n"),
|
|
}
|
|
}
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def common_init(nix: Nix):
|
|
nix.settings.add_xp_feature("nix-command", "flakes")
|
|
|
|
|
|
@with_files(files)
|
|
def test_subdir_self_path(nix: Nix, files: Path):
|
|
assert "simple> PATH=" in nix.nix(["build", f"{files}/b-low", "--no-link"]).run().ok().stderr_s
|
|
|
|
|
|
@with_files({"repo": files | get_global_asset_pack(".git"), "client": {}})
|
|
def test_git_subdir_self_path(nix: Nix, files: Path, git: Git):
|
|
repo_dir = files / "repo"
|
|
git(repo_dir, "add", ".")
|
|
git(repo_dir, "commit", "-m", "init")
|
|
|
|
client_dir = files / "client"
|
|
(client_dir / "flake.nix").write_text(f"""{{
|
|
inputs.inp = {{
|
|
type = "git";
|
|
url = "file://{repo_dir}";
|
|
dir = "b-low";
|
|
}};
|
|
|
|
outputs = inputs: rec {{
|
|
packages = inputs.inp.packages;
|
|
}};
|
|
}}""")
|
|
|
|
assert "simple> PATH=" in nix.nix(["build", client_dir, "--no-link"]).run().ok().stderr_s
|