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

Allow mixed case in pgtle.clientauth_users_to_skip and pgtle.clientauth_databases_to_skip #268

Merged
merged 7 commits into from
Mar 8, 2024

Conversation

TianzeMYou
Copy link
Contributor

@TianzeMYou TianzeMYou commented Feb 29, 2024

Issue #, if available: 265

Description of changes: Allow mixed case in pgtle.clientauth_users_to_skip and pgtle.clientauth_databases_to_skip

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -255,6 +255,46 @@
END
$$ LANGUAGE plpgsql], on_error_die => 1);
$node->psql('postgres', qq[SELECT pgtle.register_feature('reject_testuser', 'clientauth')], on_error_die => 1);
### 16. Allow mixedCase in pgtle.clientauth_users_to_skip
$node->psql('postgres', 'CREATE ROLE \"testUser3\" LOGIN', stderr => \$psql_err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is failing because the double-quotes do not need to be escaped, i.e. CREATE ROLE "testUser3".

Can you also add on_error_die => 1 to each psql command that is not supposed to error? By default psql errors don't cause tap tests to fail which can be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I digged into this a bit and I think stderr => \$psql_err is a bit better because on_error_die => 1 just fails the test but doesn't offer any output or tell us which line the test fails on

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case you'll need to verify that psql_err is empty after each psql invocation, otherwise it will populate psql_err with stderr but won't throw an error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant we have both stderr and on_error_die as arguments in the psql call?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we specify on_error_die and psql throws an error, it won't print psql_err by default iiuc. We still need a line such as like($psql_err, '')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on_error_die also emits the psql error to the regress logs. They should be uploaded as artifacts if a test run fails

test/t/004_pg_tle_clientauth.pl Outdated Show resolved Hide resolved
test/t/004_pg_tle_clientauth.pl Outdated Show resolved Hide resolved
@anth0nyleung
Copy link
Contributor

Please also remove …th_databases_to_skip from the description of the pr

test/t/004_pg_tle_clientauth.pl Outdated Show resolved Hide resolved
test/t/004_pg_tle_clientauth.pl Outdated Show resolved Hide resolved
test/t/004_pg_tle_clientauth.pl Outdated Show resolved Hide resolved
@anth0nyleung
Copy link
Contributor

anth0nyleung commented Mar 6, 2024

It's not very clear to me why we need to move the new tests to a separate file. i dont see a strong reason on why we need to split them into different files for this specific edge case.

@adamguo0
Copy link
Contributor

adamguo0 commented Mar 7, 2024

Do you mind adding your test case and updating the numbers at the top of the file as well: https://github.com/aws/pg_tle/blob/main/test/t/004_pg_tle_clientauth.pl#L24

@anth0nyleung
Copy link
Contributor

Do you mind adding your test case and updating the numbers at the top of the file as well: https://github.com/aws/pg_tle/blob/main/test/t/004_pg_tle_clientauth.pl#L24

+1 on this

@adamguo0
Copy link
Contributor

adamguo0 commented Mar 8, 2024

LGTM

@anth0nyleung anth0nyleung merged commit 3a80a32 into aws:main Mar 8, 2024
7 checks passed
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 this pull request may close these issues.

3 participants