mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
shellcheck fix: tests/functional/fetchGitVerification.sh
This commit is contained in:
parent
53ad2433b4
commit
c4c3524318
2 changed files with 13 additions and 13 deletions
|
|
@ -106,7 +106,6 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
excludes = [
|
excludes = [
|
||||||
# We haven't linted these files yet
|
# We haven't linted these files yet
|
||||||
''^tests/functional/fetchGitVerification\.sh$''
|
|
||||||
''^tests/functional/fetchMercurial\.sh$''
|
''^tests/functional/fetchMercurial\.sh$''
|
||||||
''^tests/functional/fixed\.builder1\.sh$''
|
''^tests/functional/fixed\.builder1\.sh$''
|
||||||
''^tests/functional/fixed\.builder2\.sh$''
|
''^tests/functional/fixed\.builder2\.sh$''
|
||||||
|
|
|
||||||
|
|
@ -21,29 +21,29 @@ ssh-keygen -f "$keysDir/testkey2" -t rsa -P "" -C "test key 2"
|
||||||
key2File="$keysDir/testkey2.pub"
|
key2File="$keysDir/testkey2.pub"
|
||||||
publicKey2=$(awk '{print $2}' "$key2File")
|
publicKey2=$(awk '{print $2}' "$key2File")
|
||||||
|
|
||||||
git init $repo
|
git init "$repo"
|
||||||
git -C $repo config user.email "foobar@example.com"
|
git -C "$repo" config user.email "foobar@example.com"
|
||||||
git -C $repo config user.name "Foobar"
|
git -C "$repo" config user.name "Foobar"
|
||||||
git -C $repo config gpg.format ssh
|
git -C "$repo" config gpg.format ssh
|
||||||
|
|
||||||
echo 'hello' > $repo/text
|
echo 'hello' > "$repo"/text
|
||||||
git -C $repo add text
|
git -C "$repo" add text
|
||||||
git -C $repo -c "user.signingkey=$key1File" commit -S -m 'initial commit'
|
git -C "$repo" -c "user.signingkey=$key1File" commit -S -m 'initial commit'
|
||||||
|
|
||||||
out=$(nix eval --impure --raw --expr "builtins.fetchGit { url = \"file://$repo\"; keytype = \"ssh-rsa\"; publicKey = \"$publicKey2\"; }" 2>&1) || status=$?
|
out=$(nix eval --impure --raw --expr "builtins.fetchGit { url = \"file://$repo\"; keytype = \"ssh-rsa\"; publicKey = \"$publicKey2\"; }" 2>&1) || status=$?
|
||||||
[[ $status == 1 ]]
|
[[ $status == 1 ]]
|
||||||
[[ $out =~ 'No principal matched.' ]]
|
[[ $out == *'No principal matched.'* ]]
|
||||||
[[ $(nix eval --impure --raw --expr "builtins.readFile (builtins.fetchGit { url = \"file://$repo\"; publicKey = \"$publicKey1\"; } + \"/text\")") = 'hello' ]]
|
[[ $(nix eval --impure --raw --expr "builtins.readFile (builtins.fetchGit { url = \"file://$repo\"; publicKey = \"$publicKey1\"; } + \"/text\")") = 'hello' ]]
|
||||||
|
|
||||||
echo 'hello world' > $repo/text
|
echo 'hello world' > "$repo"/text
|
||||||
|
|
||||||
# Verification on a dirty repo should fail.
|
# Verification on a dirty repo should fail.
|
||||||
out=$(nix eval --impure --raw --expr "builtins.fetchGit { url = \"file://$repo\"; keytype = \"ssh-rsa\"; publicKey = \"$publicKey2\"; }" 2>&1) || status=$?
|
out=$(nix eval --impure --raw --expr "builtins.fetchGit { url = \"file://$repo\"; keytype = \"ssh-rsa\"; publicKey = \"$publicKey2\"; }" 2>&1) || status=$?
|
||||||
[[ $status == 1 ]]
|
[[ $status == 1 ]]
|
||||||
[[ $out =~ 'dirty' ]]
|
[[ $out =~ 'dirty' ]]
|
||||||
|
|
||||||
git -C $repo add text
|
git -C "$repo" add text
|
||||||
git -C $repo -c "user.signingkey=$key2File" commit -S -m 'second commit'
|
git -C "$repo" -c "user.signingkey=$key2File" commit -S -m 'second commit'
|
||||||
|
|
||||||
[[ $(nix eval --impure --raw --expr "builtins.readFile (builtins.fetchGit { url = \"file://$repo\"; publicKeys = [{key = \"$publicKey1\";} {type = \"ssh-rsa\"; key = \"$publicKey2\";}]; } + \"/text\")") = 'hello world' ]]
|
[[ $(nix eval --impure --raw --expr "builtins.readFile (builtins.fetchGit { url = \"file://$repo\"; publicKeys = [{key = \"$publicKey1\";} {type = \"ssh-rsa\"; key = \"$publicKey2\";}]; } + \"/text\")") = 'hello world' ]]
|
||||||
|
|
||||||
|
|
@ -80,5 +80,6 @@ cat > "$flakeDir/flake.nix" <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
out=$(nix build "$flakeDir#test" 2>&1) || status=$?
|
out=$(nix build "$flakeDir#test" 2>&1) || status=$?
|
||||||
|
|
||||||
[[ $status == 1 ]]
|
[[ $status == 1 ]]
|
||||||
[[ $out =~ 'No principal matched.' ]]
|
[[ $out == *'No principal matched.'* ]]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue