Skip to content
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

run_pgaudit_test crashing the test suite #595

Closed
SlouchyButton opened this issue Oct 8, 2024 · 1 comment · Fixed by #596
Closed

run_pgaudit_test crashing the test suite #595

SlouchyButton opened this issue Oct 8, 2024 · 1 comment · Fixed by #596
Assignees

Comments

@SlouchyButton
Copy link
Contributor

This issue was introduced by #399.

A new test introduced this line in run_pgaudit_test, which in the PR had an error:
-v DOCKER_EXTRA_ARGS || cp -r "$test_dir"/examples/pgaudit/* "$config_dir"

The line is missing test at the beginning, so that the new test run_new_pgaudit_test, which doesn't really test pgaudit, rather custom extension loading via container argument, takes precedence over the custom config that is in the run_pgaudit_test to load pgaudit.

The problem is that if the config is not present, the whole test crashes with the error:

-----------------------------------------------
Running test run_pgaudit_test (starting at 2024-10-08 15:02:02+02:00) ...
-----------------------------------------------
29eecc21255a18dee73d3ca9d81786c5aafae722344559577f70160d482cd83a
Created container 29eecc21255a18dee73d3ca9d81786c5aafae722344559577f70160d482cd83a
Asserting runtime option pg-test-pgaudit
pg-test-pgaudit shared_preload_libraries pgaudit

test/run: line 352: $1: unbound variable
Tests finished with EXIT=1
==============================================
Cleaning of testing containers and images started.
It may take a few seconds.

Interesting is that it fully stops further testing, but won't really crash the testsuite as the testsuite will gracefully clean all the containers.

Another weird thing is that it fails on run_pg_audit_test already, not the new run_new_pgaudit_test.

Ideally, the test suite should still continue and mention that this test failed as described previously in this issue.
This is related to #537 where this issue was first spotted while reviewing aforementioned PR. At some later point a mistake was introduced into the PR which made test always copy the config files and generating an error (that was not caught, so tests passed). This mistake was not caught when merging the PR at that point and also made all tests pass as the changes weren't used in the test.

This mistake then started generating -v: command not found error in logs.

After fixing this issue, tests are not passing - with the same problem as from the original PR.

@SlouchyButton SlouchyButton self-assigned this Oct 8, 2024
@SlouchyButton
Copy link
Contributor Author

Problem is that DOCKER_EXTRA_ARGS variable is set already which it shouldn't be, so the test command returns 0, so no cp happens and we get the crash. Variable is empty, but apparently do exist as test -v DOCKER_EXTRA_ARGS is TRUE.

This can be fixed with replacing check for existing variable with check for empty variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant