Skip to content

Some test and test infrastructure fixes and improvements #601

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

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

alanking
Copy link
Contributor

@alanking alanking commented Aug 1, 2024

Addresses #566 (I think)
Addresses #597 (via two alternatives)

The #566 solution seemed the most expedient, and we will need to revisit that one as part of the effort for #502. Willing to work on the name.

The #597 commits are alternatives, so we need to pick one. The options are:

  1. Remove the Postgres-specific SQL assertions
  2. Change the SQL assertions to just look for a table name to make sure it's some form of actual SQL

I do not have a preference for 1 or 2 over the other. I kind of feel like the assertion is only there to assert that something is returned. The specifics of the contents seems more like the job of the GenQuery2 parser and/or API as far as testing goes, IMO.

Test suite as determined by irods/test/runner.py now passes running against iRODS 4.3.2 with postgres and mysql.

@korydraughn
Copy link
Contributor

Let's go with option 2 for #597. That is, assert that the SQL contains an expected table name. At the very least, it proves that the API is returning something.

Copy link
Contributor

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

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

Changes look good to me.

Will approve after one of the #597 commits is removed.

Copy link
Contributor Author

@alanking alanking left a comment

Choose a reason for hiding this comment

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

Okay, let's go with option 2 then. Thanks

@alanking
Copy link
Contributor Author

alanking commented Aug 1, 2024

If there are no further comments, I'll squash this down to two commits which would include the table name assertions (option 2).

@alanking
Copy link
Contributor Author

alanking commented Aug 1, 2024

Oops, I mean 3 commits. 1 for the login_auth_test rename, 1 for the genquery2_test, and 1 for commenting out the BETWEEN tests.

@korydraughn
Copy link
Contributor

If you're happy with it, squash to taste.

@alanking
Copy link
Contributor Author

alanking commented Aug 1, 2024

Squashed

Copy link
Contributor

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

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

Pound it.

The runner.py script which is used to run the full test suite looks for
files with the pattern "*_test.py". login_auth_test.py requires a special
environment and so should not be run with the regular suite of tests. It
must be run independently and manually, so the login_auth_test.py file has
been renamed to login_auth_test_must_run_manually.py in order to allow it
to continue to exist and be run, but not along with the rest of the suite.
Many of the tests in genquery2_tests.py include assertions on the
specific SQL strings generated by GenQuery2. These assertions assume
a Postgres database, causing the tests to fail on non-Postgres databases
which are nonetheless supported by the iRODS server. These assertions
have been replaced.

This changes the Postgres-specific assertions in many of the genquery2_test
tests to just assert that a table name is returned. We cannot assert the
specific contents without reaching out to the server to detect the version
and flavor of the database. Even then, the specific results may vary over
time. Testing the generated SQL is more the responsibility of the GenQuery2
parser and API in the server anyway, so this test should just be asserting
that a result that sort of looks like what we want is being returned by the
library.
The BETWEEN clause behaves differently for mysql (and mariadb, I assume)
than postgres, and the test_files_query_case_sensitive test assumes that
we are using postgres. In order to avoid this, the BETWEEN sub-tests have
been commented out until such a time as we can make meaningful assertions
about the case-sensitive query with a BETWEEN clause based on the flavor
of database being used by the connected iRODS server.
@alanking
Copy link
Contributor Author

alanking commented Aug 1, 2024

#'d. Mergin.

@alanking alanking merged commit 7af55af into irods:main Aug 1, 2024
1 check was pending
@alanking alanking deleted the 566.m branch August 1, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants