mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Move --commit-lock-file-summary tests into a separate file
This commit is contained in:
parent
fd2df5f02f
commit
e1cb905aca
3 changed files with 52 additions and 39 deletions
50
tests/functional/flakes/commit-lock-file-summary.sh
Normal file
50
tests/functional/flakes/commit-lock-file-summary.sh
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source ./common.sh
|
||||
|
||||
TODO_NixOS
|
||||
|
||||
requireGit
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
lockfileSummaryFlake=$TEST_ROOT/lockfileSummaryFlake
|
||||
|
||||
createGitRepo "$flake1Dir" ""
|
||||
createSimpleGitFlake "$flake1Dir"
|
||||
nix registry add --registry "$registry" flake1 "git+file://$flake1Dir"
|
||||
|
||||
createGitRepo "$lockfileSummaryFlake" "--initial-branch=main"
|
||||
|
||||
# Test that the --commit-lock-file-summary flag and its alias work
|
||||
cat > "$lockfileSummaryFlake/flake.nix" <<EOF
|
||||
{
|
||||
inputs = {
|
||||
flake1.url = "git+file://$flake1Dir";
|
||||
};
|
||||
|
||||
description = "lockfileSummaryFlake";
|
||||
|
||||
outputs = inputs: rec {
|
||||
packages.$system.default = inputs.flake1.packages.$system.foo;
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
git -C "$lockfileSummaryFlake" add flake.nix
|
||||
git -C "$lockfileSummaryFlake" commit -m 'Add lockfileSummaryFlake'
|
||||
|
||||
testSummary="test summary 1"
|
||||
nix flake lock "$lockfileSummaryFlake" --commit-lock-file --commit-lock-file-summary "$testSummary"
|
||||
[[ -e "$lockfileSummaryFlake/flake.lock" ]]
|
||||
[[ -z $(git -C "$lockfileSummaryFlake" diff main || echo failed) ]]
|
||||
[[ "$(git -C "$lockfileSummaryFlake" log --format=%s -n 1)" = "$testSummary" ]]
|
||||
|
||||
git -C "$lockfileSummaryFlake" rm :/:flake.lock
|
||||
git -C "$lockfileSummaryFlake" commit -m "remove flake.lock"
|
||||
testSummary="test summary 2"
|
||||
# NOTE(cole-h): We use `--option` here because Nix settings do not currently support flag-ifying the
|
||||
# alias of a setting: https://github.com/NixOS/nix/issues/10989
|
||||
nix flake lock "$lockfileSummaryFlake" --commit-lock-file --option commit-lockfile-summary "$testSummary"
|
||||
[[ -e "$lockfileSummaryFlake/flake.lock" ]]
|
||||
[[ -z $(git -C "$lockfileSummaryFlake" diff main || echo failed) ]]
|
||||
[[ "$(git -C "$lockfileSummaryFlake" log --format=%s -n 1)" = "$testSummary" ]]
|
Loading…
Add table
Add a link
Reference in a new issue