-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an acc test covering failures when reading .git (#2223)
## Changes - New test covering failures in reading .git. One case results in error, some result in warning (not shown). - New helper withdir runs commands in a subdirectory. ## Tests New acceptance test.
- Loading branch information
Showing
5 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bundle: | ||
name: git-permerror |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
=== No permission to access .git. Badness: inferred flag is set to true even though we did not infer branch. bundle_root_path is not correct in subdir case. | ||
|
||
>>> chmod 000 .git | ||
|
||
>>> $CLI bundle validate | ||
Error: unable to load repository specific gitconfig: open config: permission denied | ||
|
||
Name: git-permerror | ||
Target: default | ||
Workspace: | ||
User: $USERNAME | ||
Path: /Workspace/Users/$USERNAME/.bundle/git-permerror/default | ||
|
||
Found 1 error | ||
|
||
Exit code: 1 | ||
|
||
>>> $CLI bundle validate -o json | ||
Error: unable to load repository specific gitconfig: open config: permission denied | ||
|
||
|
||
Exit code: 1 | ||
{ | ||
"bundle_root_path": ".", | ||
"inferred": true | ||
} | ||
|
||
>>> withdir subdir/a/b $CLI bundle validate -o json | ||
Error: unable to load repository specific gitconfig: open config: permission denied | ||
|
||
|
||
Exit code: 1 | ||
{ | ||
"bundle_root_path": ".", | ||
"inferred": true | ||
} | ||
|
||
|
||
=== No permissions to read .git/HEAD. Badness: warning is not shown. inferred is incorrectly set to true. bundle_root_path is not correct in subdir case. | ||
|
||
>>> chmod 000 .git/HEAD | ||
|
||
>>> $CLI bundle validate -o json | ||
{ | ||
"bundle_root_path": ".", | ||
"inferred": true | ||
} | ||
|
||
>>> withdir subdir/a/b $CLI bundle validate -o json | ||
{ | ||
"bundle_root_path": ".", | ||
"inferred": true | ||
} | ||
|
||
|
||
=== No permissions to read .git/config. Badness: inferred is incorretly set to true. bundle_root_path is not correct is subdir case. | ||
|
||
>>> chmod 000 .git/config | ||
|
||
>>> $CLI bundle validate -o json | ||
Error: unable to load repository specific gitconfig: open config: permission denied | ||
|
||
|
||
Exit code: 1 | ||
{ | ||
"bundle_root_path": ".", | ||
"inferred": true | ||
} | ||
|
||
>>> withdir subdir/a/b $CLI bundle validate -o json | ||
Error: unable to load repository specific gitconfig: open config: permission denied | ||
|
||
|
||
Exit code: 1 | ||
{ | ||
"bundle_root_path": ".", | ||
"inferred": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
mkdir myrepo | ||
cd myrepo | ||
cp ../databricks.yml . | ||
git-repo-init | ||
mkdir -p subdir/a/b | ||
|
||
printf "=== No permission to access .git. Badness: inferred flag is set to true even though we did not infer branch. bundle_root_path is not correct in subdir case.\n" | ||
trace chmod 000 .git | ||
errcode trace $CLI bundle validate | ||
errcode trace $CLI bundle validate -o json | jq .bundle.git | ||
errcode trace withdir subdir/a/b $CLI bundle validate -o json | jq .bundle.git | ||
|
||
printf "\n\n=== No permissions to read .git/HEAD. Badness: warning is not shown. inferred is incorrectly set to true. bundle_root_path is not correct in subdir case.\n" | ||
chmod 700 .git | ||
trace chmod 000 .git/HEAD | ||
errcode trace $CLI bundle validate -o json | jq .bundle.git | ||
errcode trace withdir subdir/a/b $CLI bundle validate -o json | jq .bundle.git | ||
|
||
printf "\n\n=== No permissions to read .git/config. Badness: inferred is incorretly set to true. bundle_root_path is not correct is subdir case.\n" | ||
chmod 666 .git/HEAD | ||
trace chmod 000 .git/config | ||
errcode trace $CLI bundle validate -o json | jq .bundle.git | ||
errcode trace withdir subdir/a/b $CLI bundle validate -o json | jq .bundle.git | ||
|
||
rm -fr .git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Badness = "Warning logs not shown; inferred flag is set to true incorrect; bundle_root_path is not correct" | ||
|
||
[GOOS] | ||
# This test relies on chmod which does not work on Windows | ||
windows = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters