-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Sink schema comparison before adding metadata columns (#1778)
* add failing test for get_sink * refactor test mocks to share across modules * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * reformat * deep copy test schema so it doesnt get manipulated * fix sink schema compare test --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
88d7586
commit fd807e6
Showing
5 changed files
with
87 additions
and
53 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from __future__ import annotations | ||
|
||
import copy | ||
|
||
from tests.conftest import BatchSinkMock, TargetMock | ||
|
||
|
||
def test_get_sink(): | ||
input_schema_1 = { | ||
"properties": { | ||
"id": { | ||
"type": ["string", "null"], | ||
}, | ||
"col_ts": { | ||
"format": "date-time", | ||
"type": ["string", "null"], | ||
}, | ||
}, | ||
} | ||
input_schema_2 = copy.deepcopy(input_schema_1) | ||
key_properties = [] | ||
target = TargetMock(config={"add_record_metadata": True}) | ||
sink = BatchSinkMock(target, "foo", input_schema_1, key_properties) | ||
target._sinks_active["foo"] = sink | ||
sink_returned = target.get_sink( | ||
"foo", | ||
schema=input_schema_2, | ||
key_properties=key_properties, | ||
) | ||
assert sink_returned == sink |
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