-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add acceptance tests for schema dependency auto-detection #2169
base: main
Are you sure you want to change the base?
Changes from all commits
8a7d5fd
332a6b0
32ebc5c
893118e
1d337c8
aa52b1d
f7d926e
fc8b5e7
ed59500
fcc47de
4d09201
69d477f
a5243d6
58aca2a
ba3a36e
5eb7f4a
fa43a4d
c0d3c4f
ce4580e
d12852c
a35ab69
7dadf84
622a59d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
bundle: | ||
name: dlt-schema-field-dep-on-uc-schema | ||
|
||
resources: | ||
schemas: | ||
schema1: | ||
catalog_name: catalog1 | ||
name: foobar | ||
|
||
schema2: | ||
catalog_name: catalog2 | ||
name: foobar | ||
|
||
schema3: | ||
catalog_name: catalog1 | ||
name: barfoo | ||
|
||
pipelines: | ||
pipeline1: | ||
catalog: catalog1 | ||
schema: foobar | ||
|
||
pipeline2: | ||
catalog: catalog2 | ||
schema: foobar | ||
|
||
pipeline3: | ||
catalog: catalog1 | ||
schema: barfoo | ||
|
||
pipeline4: | ||
catalog: catalogX | ||
schema: foobar | ||
|
||
pipeline5: | ||
catalog: catalog1 | ||
schema: schemaX | ||
|
||
pipeline6: | ||
schema: foobar | ||
|
||
pipeline7: | ||
name: whatever |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"pipeline1": { | ||
"catalog": "catalog1", | ||
"schema": "${resources.schemas.schema1.name}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it expected that this is not resolved to the name? We have the name, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The terraform layer in the stack resolves any values with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work for 'name' as well? I thought it's for looking up ids. In any case, could you add this context as a comment on script? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also add 'bundle summary' to see the resolution in action? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, terraform resolves any fields that are keys in it.
Bundle summary does not resolve these references. It's resolved at runtime when
|
||
}, | ||
"pipeline2": { | ||
"catalog": "catalog2", | ||
"schema": "${resources.schemas.schema2.name}" | ||
}, | ||
"pipeline3": { | ||
"catalog": "catalog1", | ||
"schema": "${resources.schemas.schema3.name}" | ||
}, | ||
"pipeline4": { | ||
"catalog": "catalogX", | ||
"schema": "foobar" | ||
}, | ||
"pipeline5": { | ||
"catalog": "catalog1", | ||
"schema": "schemaX" | ||
}, | ||
"pipeline6": { | ||
"schema": "foobar" | ||
}, | ||
"pipeline7": { | ||
"name": "whatever" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# We expect DLT pipelines that use a schema defined in the bundle to have the | ||
# schema names replaced with a reference like `${resource.schemas.abc.name}`. | ||
$CLI bundle validate -o json | jq .resources.pipelines | jq 'map_values(del(.deployment, .permissions))' > out.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a small comment there what do you expect to see in the output. Also it should be clear -- is the output correct or is there something we want to fix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's nothing to fix. I'd assume that the tests here are for correct behaviour by default. Should we explicitly call that out in all acceptance tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Normally, it's not needed, but ${resources.*} behaviour is a bit surprising, so worth calling out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a comment for the expectation with the test itself. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
bundle: | ||
name: dlt-target-field-dep-on-uc-schema | ||
|
||
resources: | ||
schemas: | ||
schema1: | ||
catalog_name: catalog1 | ||
name: foobar | ||
|
||
schema2: | ||
catalog_name: catalog2 | ||
name: foobar | ||
|
||
schema3: | ||
catalog_name: catalog1 | ||
name: barfoo | ||
|
||
pipelines: | ||
pipeline1: | ||
catalog: catalog1 | ||
target: foobar | ||
|
||
pipeline2: | ||
catalog: catalog2 | ||
target: foobar | ||
|
||
pipeline3: | ||
catalog: catalog1 | ||
target: barfoo | ||
|
||
pipeline4: | ||
catalog: catalogX | ||
target: foobar | ||
|
||
pipeline5: | ||
catalog: catalog1 | ||
target: schemaX | ||
|
||
pipeline6: | ||
target: foobar | ||
|
||
pipeline7: | ||
name: whatever |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"pipeline1": { | ||
"catalog": "catalog1", | ||
"target": "${resources.schemas.schema1.name}" | ||
}, | ||
"pipeline2": { | ||
"catalog": "catalog2", | ||
"target": "${resources.schemas.schema2.name}" | ||
}, | ||
"pipeline3": { | ||
"catalog": "catalog1", | ||
"target": "${resources.schemas.schema3.name}" | ||
}, | ||
"pipeline4": { | ||
"catalog": "catalogX", | ||
"target": "foobar" | ||
}, | ||
"pipeline5": { | ||
"catalog": "catalog1", | ||
"target": "schemaX" | ||
}, | ||
"pipeline6": { | ||
"target": "foobar" | ||
}, | ||
"pipeline7": { | ||
"name": "whatever" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# We expect DLT pipelines that use a schema defined in the bundle to have the | ||
# schema names replaced with a reference like `${resource.schemas.abc.name}`. | ||
$CLI bundle validate -o json | jq .resources.pipelines | jq 'map_values(del(.deployment, .permissions))' > out.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
bundle: | ||
name: volume-deps-on-schema | ||
|
||
resources: | ||
schemas: | ||
schema1: | ||
catalog_name: catalog1 | ||
name: foobar | ||
|
||
schema2: | ||
catalog_name: catalog2 | ||
name: foobar | ||
|
||
schema3: | ||
catalog_name: catalog1 | ||
name: barfoo | ||
|
||
volumes: | ||
volume1: | ||
catalog_name: catalog1 | ||
schema_name: foobar | ||
|
||
volume2: | ||
catalog_name: catalog2 | ||
schema_name: foobar | ||
|
||
volume3: | ||
catalog_name: catalog1 | ||
schema_name: barfoo | ||
|
||
volume4: | ||
catalog_name: catalogX | ||
schema_name: foobar | ||
|
||
volume5: | ||
catalog_name: catalog1 | ||
schema_name: schemaX |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"volume1": { | ||
"catalog_name": "catalog1", | ||
"schema_name": "${resources.schemas.schema1.name}", | ||
"volume_type": "MANAGED" | ||
}, | ||
"volume2": { | ||
"catalog_name": "catalog2", | ||
"schema_name": "${resources.schemas.schema2.name}", | ||
"volume_type": "MANAGED" | ||
}, | ||
"volume3": { | ||
"catalog_name": "catalog1", | ||
"schema_name": "${resources.schemas.schema3.name}", | ||
"volume_type": "MANAGED" | ||
}, | ||
"volume4": { | ||
"catalog_name": "catalogX", | ||
"schema_name": "foobar", | ||
"volume_type": "MANAGED" | ||
}, | ||
"volume5": { | ||
"catalog_name": "catalog1", | ||
"schema_name": "schemaX", | ||
"volume_type": "MANAGED" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# We expect UC Volumes that use a schema defined in the bundle to have the | ||
# schema names replaced with a reference like `${resource.schemas.abc.name}`. | ||
$CLI bundle validate -o json | jq .resources.volumes > out.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the unit tests? Is there something they cover that this acceptance tests won't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, mostly. They're local to the mutator itself, which implements the functionality, and that's why I did not remove them. Unit tests next to the code are nice to have and can live independently of the acceptance tests.
There's some additional coverage for what happens when the resources pointers are
nil
, but nothing that absolutely needs to be covered, IMO.