Merged
Conversation
…ydra_setup` Ever since `HydraTestContext` was introduced (eca09bc, 2021) to fix teardown errors, its `db()` had created the root user on first access — making the older `hydra_setup($db)` idiom redundant. But not every test was converted from the `hydra_setup` way of doing things, and also subsequent test files continued copying the older pattern of `Hydra::Model::DB->new` + `hydra_setup($db)` from neighboring tests. Also `createBaseJobset` internally constructed its own `Hydra::Model::DB->new` handle. Now, Migrate all tests to the `$ctx->db()` / `$ctx{context}->db()` pattern and pass the `$db` handle explicitly to `createBaseJobset` and `createJobsetWithOneInput` instead of letting them create their own.
…::Model::DB` In general, it is better not to use the app to test the app. Relying on just the database framework but not also the web framework is a strict improvement. `Hydra::Model::DB` is a `Catalyst::Model::DBIC::Schema` subclass — a Catalyst adapter around DBIC. Tests never needed Catalyst; they just needed a database handle. The original tests (890a786, 2011) connected directly via `openHydraDB`. The Catalyst dependency was introduced in fa62c8b (2012) when that was replaced with `Hydra::Model::DB->new`, and it stuck. Now that all test files obtain their `$db` from `HydraTestContext::db()`, we can switch that single callsite from `Hydra::Model::DB->new()` to `Hydra::Schema->connect(...)`. The `DESTROY` method is adjusted accordingly: `->storage->disconnect()` instead of `->schema->storage->disconnect()`, since we now hold the schema object directly rather than a Catalyst model wrapper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See each commit for details. We're making the tests operate in both a more consistent and less indirect manner.