From 9c691e451f7f82677a3d1a78a14c46b2ef77203a Mon Sep 17 00:00:00 2001 From: Stefan Negele Date: Thu, 23 Nov 2023 12:19:47 +0100 Subject: [PATCH] Test comparision via models section on breaking command --- breaking_test.go | 8 +++---- .../breaking/breaking_datacontract.yaml | 13 ++++++++++++ test_resources/breaking/datacontract.yaml | 13 ++++++++++++ .../breaking/dbt_breaking_datacontract.yaml | 18 ---------------- test_resources/breaking/dbt_datacontract.yaml | 18 ---------------- .../dbt_not_breaking_datacontract.yaml | 21 ------------------- .../breaking/not_breaking_datacontract.yaml | 16 ++++++++++++++ 7 files changed, 46 insertions(+), 61 deletions(-) create mode 100755 test_resources/breaking/breaking_datacontract.yaml create mode 100755 test_resources/breaking/datacontract.yaml delete mode 100755 test_resources/breaking/dbt_breaking_datacontract.yaml delete mode 100755 test_resources/breaking/dbt_datacontract.yaml delete mode 100755 test_resources/breaking/dbt_not_breaking_datacontract.yaml create mode 100755 test_resources/breaking/not_breaking_datacontract.yaml diff --git a/breaking_test.go b/breaking_test.go index 1a8703eb..f1e5e22b 100644 --- a/breaking_test.go +++ b/breaking_test.go @@ -15,8 +15,8 @@ func TestBreaking(t *testing.T) { { name: "breaking", args: args{ - dataContractLocation: "test_resources/breaking/dbt_breaking_datacontract.yaml", - stableDataContractLocation: "test_resources/breaking/dbt_datacontract.yaml", + dataContractLocation: "test_resources/breaking/breaking_datacontract.yaml", + stableDataContractLocation: "test_resources/breaking/datacontract.yaml", pathToType: []string{"schema", "type"}, pathToSpecification: []string{"schema", "specification"}, }, @@ -35,8 +35,8 @@ InternalField: my_column { name: "not-breaking", args: args{ - dataContractLocation: "test_resources/breaking/dbt_not_breaking_datacontract.yaml", - stableDataContractLocation: "test_resources/breaking/dbt_datacontract.yaml", + dataContractLocation: "test_resources/breaking/not_breaking_datacontract.yaml", + stableDataContractLocation: "test_resources/breaking/datacontract.yaml", pathToType: []string{"schema", "type"}, pathToSpecification: []string{"schema", "specification"}, }, diff --git a/test_resources/breaking/breaking_datacontract.yaml b/test_resources/breaking/breaking_datacontract.yaml new file mode 100755 index 00000000..290f3bcc --- /dev/null +++ b/test_resources/breaking/breaking_datacontract.yaml @@ -0,0 +1,13 @@ +dataContractSpecification: 0.9.1 +id: my-data-contract-id +info: + title: My Data Contract + version: 0.0.1 +models: + my_table: + description: "contains data" + type: table + fields: + my_column_2: + type: text + description: "contains values" diff --git a/test_resources/breaking/datacontract.yaml b/test_resources/breaking/datacontract.yaml new file mode 100755 index 00000000..c53e1220 --- /dev/null +++ b/test_resources/breaking/datacontract.yaml @@ -0,0 +1,13 @@ +dataContractSpecification: 0.9.1 +id: my-data-contract-id +info: + title: My Data Contract + version: 0.0.1 +models: + my_table: + description: "contains data" + type: table + fields: + my_column: + type: text + description: "contains values" diff --git a/test_resources/breaking/dbt_breaking_datacontract.yaml b/test_resources/breaking/dbt_breaking_datacontract.yaml deleted file mode 100755 index 3f5422c1..00000000 --- a/test_resources/breaking/dbt_breaking_datacontract.yaml +++ /dev/null @@ -1,18 +0,0 @@ -dataContractSpecification: 0.9.1 -id: my-data-contract-id -info: - title: My Data Contract - version: 0.0.1 -schema: - specification: | - version: 2 - models: - - name: my_table - description: "contains data" - config: - materialized: table - columns: - - name: my_column_2 - data_type: text - description: "contains values" - type: dbt diff --git a/test_resources/breaking/dbt_datacontract.yaml b/test_resources/breaking/dbt_datacontract.yaml deleted file mode 100755 index efd79ce9..00000000 --- a/test_resources/breaking/dbt_datacontract.yaml +++ /dev/null @@ -1,18 +0,0 @@ -dataContractSpecification: 0.9.1 -id: my-data-contract-id -info: - title: My Data Contract - version: 0.0.1 -schema: - specification: | - version: 2 - models: - - name: my_table - description: "contains data" - config: - materialized: table - columns: - - name: my_column - data_type: text - description: "contains values" - type: dbt diff --git a/test_resources/breaking/dbt_not_breaking_datacontract.yaml b/test_resources/breaking/dbt_not_breaking_datacontract.yaml deleted file mode 100755 index 909497eb..00000000 --- a/test_resources/breaking/dbt_not_breaking_datacontract.yaml +++ /dev/null @@ -1,21 +0,0 @@ -dataContractSpecification: 0.9.1 -id: my-data-contract-id -info: - title: My Data Contract - version: 0.0.1 -schema: - specification: | - version: 2 - models: - - name: my_table - description: "contains data" - config: - materialized: table - columns: - - name: my_column - data_type: text - description: "contains values" - - name: my_column_2 - data_type: text - description: "contains values" - type: dbt diff --git a/test_resources/breaking/not_breaking_datacontract.yaml b/test_resources/breaking/not_breaking_datacontract.yaml new file mode 100755 index 00000000..2c0db1cd --- /dev/null +++ b/test_resources/breaking/not_breaking_datacontract.yaml @@ -0,0 +1,16 @@ +dataContractSpecification: 0.9.1 +id: my-data-contract-id +info: + title: My Data Contract + version: 0.0.1 +models: + my_table: + description: "contains data" + type: table + fields: + my_column: + type: text + description: "contains values" + my_column_2: + type: text + description: "contains values"