Skip to content

Issue #8417 : Use the unit test database replacement in Database Lookup - #8520

Merged
hansva merged 1 commit into
apache:mainfrom
mattcasters:issue-8417
Sep 22, 2026
Merged

hansva merged 1 commit into
apache:mainfrom
mattcasters:issue-8417

Conversation

@mattcasters

Copy link
Copy Markdown
Contributor

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.

PipelineMetaModifier called DatabaseMeta.replaceMeta() on the object returned by findDatabase(). 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 with source-db still opened source-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_CONNECTION marker, so those fields are marked as well.

Fixes #8417.

How to verify

./mvnw -pl plugins/misc/testing -am test -Dtest=PipelineMetaModifierTest -Dsurefire.failIfNoSpecifiedTests=false

The 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.

@hansva
hansva merged commit 7fa61fc into apache:main Sep 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipeline unit test database replacement is not used by DBLookup at runtime

2 participants