-
Notifications
You must be signed in to change notification settings - Fork 361
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
Introduce shared context for migrations and add documentation #3407
Merged
Conversation
This file contains 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
FloThinksPi
force-pushed
the
db_migration_test_framework
branch
from
September 4, 2023 14:18
d3e347a
to
39795c4
Compare
FloThinksPi
force-pushed
the
db_migration_test_framework
branch
from
September 6, 2023 09:20
39795c4
to
8dd73dc
Compare
FloThinksPi
changed the title
Introduce MigrationMixin and document Sequel migration tests
Introduce MigrationMixin and document migration and tests
Sep 6, 2023
FloThinksPi
force-pushed
the
db_migration_test_framework
branch
2 times, most recently
from
September 6, 2023 09:33
cd91acd
to
3bd3ee7
Compare
Here is the existing CAPI-Migration-Style-Guide. We should merge the contents and decide for a single location (and reference it from the other location). |
5 tasks
FloThinksPi
force-pushed
the
db_migration_test_framework
branch
5 times, most recently
from
September 14, 2023 11:26
dcb0ab4
to
f1eb75a
Compare
philippthun
reviewed
Sep 21, 2023
philippthun
reviewed
Sep 22, 2023
philippthun
reviewed
Sep 22, 2023
philippthun
force-pushed
the
db_migration_test_framework
branch
from
September 26, 2023 15:26
31068cc
to
45c49e7
Compare
Previously a migration was only tested by reverting (running down migrations) until being one migration before the one that shall be tested, then executing the actual test in which all migrations run the up part even of migrations that come after the migration one wants to test. This commit introduces the 'migration' shared context, a valuable utility for Sequel migration testing. This new module reverts the database schema to its version prior to a specific migration, provides a directory with the migration file for running a given migration in a test, and restores the schema to its full state after test completion to avoid half-migrated database scenarios. Hereby only the up part of the migration one wants to test is executed opposite to all available migrations to construct a meaningful test case. The accompanying updates to the documentation elaborate on the distinctive operating nature of Sequel migration tests. Also extensive documentation on Sequel migrations itself in the scope of the supported dbs and cloud_controller_ng has been added to provide a good knowledge base for writing highly sophisticated migrations that are resilient, offer high level of consistency, are compatible with mysql and psql and fast. Constraints and restrictions on Sequel migrations and test writing have also been detailed, stressing the need to exclude Cloud Controller code in migrations and tests to maintain consistency in test outcomes and behaviours. Co-authored-by: Philipp Thun <[email protected]>
philippthun
force-pushed
the
db_migration_test_framework
branch
from
September 27, 2023 15:16
45c49e7
to
2ba8386
Compare
philippthun
changed the title
Introduce MigrationMixin and document migration and tests
Introduce shared context for migrations and add documentation
Sep 27, 2023
philippthun
approved these changes
Sep 27, 2023
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.
Previously a migration was only tested by reverting (running down migrations) until being one migration before the one that shall be tested, then executing the actual test in which all migrations run the up part even of migrations that come after the migration one wants to test.
This commit introduces the 'migration' shared context, a valuable utility for Sequel migration testing. This new module reverts the database schema to its version prior to a specific migration, provides a directory with the migration file for running a given migration in a test, and restores the schema to its full state after test completion to avoid half-migrated database scenarios. Hereby only the up part of the migration one wants to test is executed opposite to all available
migrations to construct a meaningful test case.
The accompanying updates to the documentation elaborate on the distinctive operating nature of Sequel migration tests. Also extensive documentation on Sequel migrations itself in the scope of the supported dbs and cloud_controller_ng has been added to provide a good knowledge base for writing highly sophisticated migrations that are resilient, offer high level of consistency, are compatible with mysql and psql and fast.
Constraints and restrictions on Sequel migrations and test writing have also been detailed, stressing the need to exclude Cloud Controller code in migrations and tests to maintain consistency in test outcomes and behaviours.
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
main
branchI have run all the unit tests using
bundle exec rake
I have run CF Acceptance Tests