Repository navigation
Issue #8417 : Use the unit test database replacement in Database Lookup - #8520
Merged
Merged
Conversation
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.
What this does
A pipeline unit test database replacement was logged and then discarded. Database Lookup, and every other transform that stores a connection name, still opened the original database.
PipelineMetaModifiercalledDatabaseMeta.replaceMeta()on the object returned byfindDatabase(). That load is either a throwaway copy (project JSON metadata) or the shared metadata object (in-memory provider). Transforms never read that object. They keep the connection name and load it again at runtime, so a lookup configured withsource-dbstill openedsource-db.The in-memory test copy now rewrites relational connection names (
RDBMS_CONNECTION) from the original connection to the replacement. The project connection and the pipeline on disk are unchanged. Replacements are applied once and do not chain. A connection name that is a variable is resolved first and then stored as the literal replacement name.Add Sequence, Get Table Names, JDBC Metadata, and Synchronize after merge stored a relational connection without the
RDBMS_CONNECTIONmarker, so those fields are marked as well.Fixes #8417.
How to verify
./mvnw -pl plugins/misc/testing -am test -Dtest=PipelineMetaModifierTest -Dsurefire.failIfNoSpecifiedTests=falseThe test uses a Generic connection with the SQL Server driver class and an H2 replacement. It checks that the copied Database Lookup resolves to the H2 driver, that the original connection is not modified, that a
${DB}reference becomes the literal replacement, and that a missing replacement still fails without touching the source connection.