test/with-pgenvblock: add additional test - #2204
Merged
Merged
Conversation
Extracted from discarded PR getodk#2119
alxndrsn
marked this pull request as ready for review
September 6, 2026 05:08
Member
|
I went ahead and tagged @lognaturel, since IIRC she reviewed the original version of this code. |
alxndrsn
marked this pull request as draft
September 6, 2026 05:59
Contributor
Author
|
It looks like the old test relied on being the last-executed line, so no longer fails the script if the test fails. |
alxndrsn
commented
Sep 6, 2026
| # note that the environment setting (with `export`) runs in a subshell, and as such doesn't touch our own environment, | ||
| # and as such thus also not the environment with-pgenvblock.pl's is launched with; and thus the PGBLA environment variable | ||
| # that the `env` invocation sees comes from `with-pgenvblock.pl`'s reading of the env block file and nowhere else. | ||
| files/service/with-pgenvblock.pl <(export PGBLA=hurray; cat /proc/self/environ) env | grep --quiet '^PGBLA=hurray$' || (printf >&2 "No, it doesn't\n"; false) && printf >&2 "Yes\n" |
Contributor
Author
There was a problem hiding this comment.
This structure had to change because it wasn't triggering set -e handling due to its structure:
The shell does not exit if the command that fails is part of ... any command executed in a
&&or||list except the command following the final&&or||
-https://doc.guix.gnu.org/bash/latest/en/html_node/The-Set-Builtin.html
alxndrsn
marked this pull request as ready for review
September 6, 2026 06:48
lognaturel
approved these changes
Sep 15, 2026
alxndrsn
commented
Sep 17, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Example outputs
Old version
Passing
Failing
$ ./test/test-with-pgenvblock.sh Checking whether with-pgenvblock.pl works… No, it doesn'tNew version
Passing
$ ./test/test-with-pgenvblock.sh [test-with-pgenvblock] Testing... [test-with-pgenvblock] Testing: specific postgres-related variables... [test-with-pgenvblock] Passed OK. [test-with-pgenvblock] Testing: local env with injected var... [test-with-pgenvblock] Passed OK. [test-with-pgenvblock] All tests passed OK.Failing first test
Failing second test
Extracted from discarded PR #2119
Should help with #1793
What has been done to verify that this works as intended?
It's a new test - the test was run.
Also it allowed identification of #2203.
Why is this the best possible solution? Were any other approaches considered?
The logging adds clarity around execution of the existing test, and adds an additional test which makes specific test cases easier to add.
How does this change impact users? Describe intentional behavior changes from code updates. What are the regression risks?
No change - just tests.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.