Skip to content
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

Remove @dataform/assertion-utils in favor of auto-assertions #1419

Merged
merged 4 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions packages/@dataform/assertion_utils/BUILD

This file was deleted.

57 changes: 0 additions & 57 deletions packages/@dataform/assertion_utils/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/@dataform/assertion_utils/tslint.json

This file was deleted.

1 change: 0 additions & 1 deletion scripts/publish
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ fi

bazel test //... --build_tests_only -- -tests/integration:snowflake.spec

bazel run packages/@dataform/assertion_utils:package.publish
bazel run packages/@dataform/cli:package.publish
bazel run packages/@dataform/core:package.publish
bazel run cli:push
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/bigquery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ suite("@dataform/integration/bigquery", { parallel: true }, ({ before, after })
const executedGraph = await dfapi.run(dbadapter, executionGraph).result();

const actionMap = keyBy(executedGraph.actions, v => targetAsReadableString(v.target));
expect(Object.keys(actionMap).length).eql(19);
expect(Object.keys(actionMap).length).eql(17);

// Check the status of action execution.
const expectedFailedActions = [
"dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_uniqueness_fail",
"dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_fail",
"dataform-integration-tests.df_integration_test_eu_project_e2e.example_operation_partial_fail"
];
Expand All @@ -61,7 +60,7 @@ suite("@dataform/integration/bigquery", { parallel: true }, ({ before, after })

expect(
actionMap[
"dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_uniqueness_fail"
"dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_fail"
].tasks[1].errorMessage
).to.eql("bigquery error: Assertion failed: query returned 1 row(s).");

Expand Down
1 change: 0 additions & 1 deletion tests/integration/bigquery_project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ filegroup(
node_modules(
name = "node_modules",
deps = [
"//packages/@dataform/assertion_utils:package_tar",
"//packages/@dataform/core:package_tar",
],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {
type: "assertion"
}

WITH base AS (
SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1
)
SELECT * FROM base WHERE row_count > 1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
config { type: "assertion" }
config {
type: "assertion"
}

js { const assertionUtils = require("@dataform/assertion_utils"); }

${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()}
WITH base AS (
SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2
)
SELECT * FROM base WHERE row_count > 1

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config {
type: "view",
hermetic: false,
hermetic: false
}

select ${when(dataform.projectConfig.vars.fooVar === "bar", "1", "2")} as val union all
Expand Down
7 changes: 3 additions & 4 deletions tests/integration/postgres.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ suite("@dataform/integration/postgres", { parallel: true }, ({ before, after })
let executedGraph = await dfapi.run(dbadapter, executionGraph).result();

const actionMap = keyBy(executedGraph.actions, v => targetAsReadableString(v.target));
expect(Object.keys(actionMap).length).eql(13);
expect(Object.keys(actionMap).length).eql(11);

// Check the status of action execution.
const expectedFailedActions = [
"df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail",
"df_integration_test_assertions_project_e2e.example_assertion_fail"
];
for (const actionName of Object.keys(actionMap)) {
Expand All @@ -55,8 +54,8 @@ suite("@dataform/integration/postgres", { parallel: true }, ({ before, after })
}

expect(
actionMap["df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail"]
.tasks[2].errorMessage
actionMap["df_integration_test_assertions_project_e2e.example_assertion_fail"].tasks[2]
.errorMessage
).to.eql("postgres error: Assertion failed: query returned 1 row(s).");

// Check the data in the incremental table.
Expand Down
1 change: 0 additions & 1 deletion tests/integration/postgres_project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ filegroup(
node_modules(
name = "node_modules",
deps = [
"//packages/@dataform/assertion_utils:package_tar",
"//packages/@dataform/core:package_tar",
],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {
type: "assertion"
}

WITH base AS (
SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1
)
SELECT * FROM base WHERE row_count > 1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
config { type: "assertion" }
config {
type: "assertion"
}

js { const assertionUtils = require("@dataform/assertion_utils"); }

${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()}
WITH base AS (
SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2
)
SELECT * FROM base WHERE row_count > 1

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion tests/integration/presto_project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ filegroup(
node_modules(
name = "node_modules",
deps = [
"//packages/@dataform/assertion_utils:package_tar",
"//packages/@dataform/core:package_tar",
],
)
5 changes: 2 additions & 3 deletions tests/integration/redshift.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ suite("@dataform/integration/redshift", { parallel: true }, ({ before, after })

// Check the status of action execution.
const expectedFailedActions = [
"df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail",
"df_integration_test_assertions_project_e2e.example_assertion_fail"
];
for (const actionName of Object.keys(actionMap)) {
Expand All @@ -55,8 +54,8 @@ suite("@dataform/integration/redshift", { parallel: true }, ({ before, after })
}

expect(
actionMap["df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail"]
.tasks[2].errorMessage
actionMap["df_integration_test_assertions_project_e2e.example_assertion_fail"].tasks[2]
.errorMessage
).to.eql("redshift error: Assertion failed: query returned 1 row(s).");

// Check the status of the s3 load operation.
Expand Down
1 change: 0 additions & 1 deletion tests/integration/redshift_project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ filegroup(
node_modules(
name = "node_modules",
deps = [
"//packages/@dataform/assertion_utils:package_tar",
"//packages/@dataform/core:package_tar",
],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {
type: "assertion"
}

WITH base AS (
SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1
)
SELECT * FROM base WHERE row_count > 1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
config { type: "assertion" }
config {
type: "assertion"
}

js { const assertionUtils = require("@dataform/assertion_utils"); }

${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()}
WITH base AS (
SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2
)
SELECT * FROM base WHERE row_count > 1

This file was deleted.

This file was deleted.

5 changes: 2 additions & 3 deletions tests/integration/snowflake.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ suite("@dataform/integration/snowflake", ({ before, after }) => {
let executedGraph = await dfapi.run(dbadapter, executionGraph).result();

const actionMap = keyBy(executedGraph.actions, v => targetAsReadableString(v.target));
expect(Object.keys(actionMap).length).eql(20);
expect(Object.keys(actionMap).length).eql(18);

// Check the status of action execution.
const expectedFailedActions = [
"INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_UNIQUENESS_FAIL",
"INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_FAIL"
];
for (const actionName of Object.keys(actionMap)) {
Expand All @@ -65,7 +64,7 @@ suite("@dataform/integration/snowflake", ({ before, after }) => {

expect(
actionMap[
"INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_UNIQUENESS_FAIL"
"INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_FAIL"
].tasks[1].errorMessage
).to.eql("snowflake error: Assertion failed: query returned 1 row(s).");

Expand Down
1 change: 0 additions & 1 deletion tests/integration/snowflake_project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ filegroup(
node_modules(
name = "node_modules",
deps = [
"//packages/@dataform/assertion_utils:package_tar",
"//packages/@dataform/core:package_tar",
],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {
type: "assertion"
}

WITH base AS (
SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1
)
SELECT * FROM base WHERE row_count > 1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
config { type: "assertion" }
config {
type: "assertion"
}

js { const assertionUtils = require("@dataform/assertion_utils"); }

${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()}
WITH base AS (
SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2
)
SELECT * FROM base WHERE row_count > 1

This file was deleted.

This file was deleted.

Loading