-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an acc test covering failures when reading .git #2223
Conversation
local exit_code=$? | ||
cd "$orig_dir" || return $? | ||
return $exit_code | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's easier/shorter to just use a subshell.
E.g.
(
cd subdir/a/b
errcode trace $CLI bundle validate -o json | jq .bundle.git
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean using subshell directly in script?
It's not shorter, especially if you consider that you also want to trace cd command and then you have it appearing in the output as a separate line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we're comparing:
script:
errcode trace withdir subdir/a/b $CLI bundle validate -o json | jq .bundle.git
output:
>>> withdir subdir/a/b $CLI bundle validate -o json
vs
script:
(
trace cd subdir/a/b
errcode trace $CLI bundle validate -o json | jq .bundle.git
)
output:
>>> cd subdir/a/b
>>> $CLI bundle validate -o json
Note, in the output you cannot see that you're inside a subshell and that cd subdir/a/b
only applies to next statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks.
311d3f9
to
15b5b8a
Compare
65a6507
to
b58a5e8
Compare
b58a5e8
to
ccd1f1f
Compare
## Changes - Acceptance tests load test.toml to configure test behaviour. - If file is not found in the test directory, parents are searched, until the test root. - Currently there is one option: runtime.GOOS to switch off tests per OS. ## Tests Using it in #2223 to disable test on Windows that cannot be run there.
fb41bad
to
e3c5225
Compare
local exit_code=$? | ||
cd "$orig_dir" || return $? | ||
return $exit_code | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use the "title" helper instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh, that helper feels unnecessary to me. It also does not add a new line at the end for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, in some cases I want a couple of front newlines and in one case I won't none.
Changes
Tests
New acceptance test.