testing: migrates flakes/subdir-flake.sh
Change-Id: I9ac02056d490473dd751f7ec7857840290f5afc5
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
source common.sh
|
||||
requireGit
|
||||
clearStore
|
||||
|
||||
container="$TEST_HOME"/flake-container
|
||||
flake_dir="$container"/flake-dir
|
||||
|
||||
createGitRepo "$container"
|
||||
mkdir -p "$flake_dir"
|
||||
writeSimpleFlake "$flake_dir"
|
||||
git -C "$container" add flake-dir
|
||||
|
||||
pushd "$flake_dir" &>/dev/null
|
||||
info="$(nix flake info --json)"
|
||||
[[ "$(jq -r '.resolvedUrl' <<<"$info")" == git+file://*/flake-container?dir=flake-dir ]]
|
||||
[[ "$(jq -r '.url' <<<"$info")" == git+file://*/flake-container?dir=flake-dir ]]
|
||||
|
||||
# Make sure we can actually access & build stuff in this flake.
|
||||
nix build "path:$flake_dir#foo" -L
|
||||
popd &>/dev/null
|
||||
@@ -43,7 +43,6 @@ functional_tests_scripts = [
|
||||
'flakes/flake-in-submodule.sh',
|
||||
'flakes/flake-metadata.sh',
|
||||
'flakes/flake-registry.sh',
|
||||
'flakes/subdir-flake.sh',
|
||||
'gc.sh',
|
||||
'nix-collect-garbage-d.sh',
|
||||
'nix-collect-garbage-dry-run.sh',
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
from fnmatch import fnmatch
|
||||
from testlib.fixtures.git import Git
|
||||
from testlib.fixtures.nix import Nix
|
||||
from testlib.fixtures.file_helper import with_files
|
||||
from testlib.utils import get_global_asset_pack
|
||||
from pathlib import Path
|
||||
from .common import simple_flake
|
||||
|
||||
|
||||
@with_files({"flake-container": get_global_asset_pack(".git") | {"flake-dir": simple_flake()}})
|
||||
def test_subdir_flake(nix: Nix, files: Path, git: Git):
|
||||
container = files / "flake-container"
|
||||
flake = container / "flake-dir"
|
||||
|
||||
nix.settings.add_xp_feature("nix-command", "flakes")
|
||||
|
||||
git(container, "add", "flake-dir")
|
||||
|
||||
info = nix.nix(["flake", "info", "--json"], cwd=flake).run().json()
|
||||
|
||||
assert fnmatch(info["resolvedUrl"], "git+file://*/flake-container[?]dir=flake-dir")
|
||||
assert fnmatch(info["url"], "git+file://*/flake-container[?]dir=flake-dir")
|
||||
|
||||
nix.nix(["build", f"path:{flake}#foo", "-L"]).run().ok()
|
||||
Reference in New Issue
Block a user