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

[WIP] SA2.0, model/data-access edits, unit testing #17662

Closed
wants to merge 26 commits into from

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented Mar 11, 2024

Replaces #17551 (accidentally deleted the remote branch due to slip of the finger)

Simple model and data-access unit testing. Db created and loaded once per session; cleared after each test. Dependent model instances created recursively as needed, with provided arguments or reasonable defaults.
Draft.
Builds on #17180.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jdavcs jdavcs added kind/bug kind/enhancement kind/refactoring cleanup or refactoring of existing code, no functional changes kind/feature area/database Galaxy's database or data access layer labels Mar 11, 2024
@jdavcs jdavcs added this to the 24.1 milestone Mar 11, 2024
@@ -335,3 +337,12 @@ def serialize_job_state_summary(self, item, key, **context):
def serialize_elements_datatypes(self, item, key, **context):
extensions_set = item.dataset_dbkeys_and_extensions_summary[1]
return list(extensions_set)


def get_hdca_by_name(session, name):
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to belong in managers to me because it doesn't use trans or app. Also this code is only used in tests as far as I can grep - should just be moved to galaxy.model.unittest_utils.model_testing_utils or a new file like galaxy.model.unittest_utils.helpers. I think there is something jarring about seeing code like this mixed with app logic - I was immediately scared we were accessing data this way from the app.

@jdavcs jdavcs force-pushed the dev_data_access branch 3 times, most recently from 0aba698 to 1ce7dfd Compare March 25, 2024 15:40
jdavcs added 8 commits April 12, 2024 16:33
Tests SQLAlchemy:

1. Create tag
2. Verify there's no FooTagAssociation with this tag
3. Add new FooTagAssociation to Foo and save to db
4. Verify there is one FooTagAssociation with this tag
No assert (only TODO); but would test SQLAlchemy
Tests SQLAlchemy, user-history relationship mapping
Tests SQLAlchemy (create foo + set foo.bar + load foo + check bar)
@jdavcs
Copy link
Member Author

jdavcs commented Jun 4, 2024

Superseded by #18312 (code review comments addressed)

@jdavcs jdavcs closed this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer kind/bug kind/enhancement kind/feature kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants