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.
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
feat: reduce user interaction in
quicksetup
#5768feat: reduce user interaction in
quicksetup
#5768Changes from all commits
6514897
5861bdf
54c2d32
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Could we add an additional case here where you pass an invalid password to see it creates a new user automatically? Or do we hit the same problem potentially where certain postgres servers trust local connections? Is this the case for our CI setup? If not, I would still add the test (as well as the one you commented out) just so we have more coverage. If it then fails when people run the tests locally and they have their postgres configured that way, that is ok I think.
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.
Hm... I've thought about it but is it really worth adding a test here that may fail depending on the details of the test setup?
The only thing this test would add is to check that psycopg2 throws the same exception when the password is wrong as when the user name is wrong (wrong user name is already tested).
I've checked that manually, and it does.
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.
What I mean though is that lines 221-224 of
create_dbuser_db_safe
are never hit in this test. In the first test, the user doesn't exist, and so the first conditional is hit and it is created. In the second test, the user exists and it can authenticate, so it goes straight to the database creation, skipping the block withself.find_new_user
. So is that actually getting covered now by the tests? And my point here is that it is better to have that test covered in our CI and have it potentially fail if some developer runs the test locally and has a weird Postgres configuration. Anyway, aren't you testing this against a complete mock cluster provided byPGTest
? So this should never fail, should it?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.
PGTest
currently hardcodes thetrust
authentication method, i.e. when using the temporary postgres cluster the test will always failhttps://github.com/jamesnunn/pgtest/blob/417f0d89e66a9395db694a96122e0d5ac0097d59/pgtest/pgtest.py#L506-L507
I will open an issue for this to remind ourselves, also related to #3762
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.
Ok, so that means adding the test I suggested will fail on GHA? If so, then I guess we can leave it for now, but it would be good to fix in the future so we can increase coverage.
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.
Correct, see
aiida-core/.github/workflows/ci-code.yml
Line 60 in 5b6b2b2
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 opened jamesnunn/pgtest#24
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.
We can have a look here at what happens today if we require passwords for postgres
#5776