Skip to content

Commit

Permalink
fix deprecated tests (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
haritamar authored Jul 7, 2024
1 parent 42fb88c commit 8b21e86
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
41 changes: 20 additions & 21 deletions integration_tests/deprecated_tests/run_e2e_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_row(alias: str, dbt_runner: BaseDbtRunner) -> str:
dbt_runner.run_operation(
"elementary_integration_tests.read_table",
macro_args={"table": "dbt_models", "where": f"alias = '{alias}'"},
should_log=False,
return_raw_edr_logs=True,
)[0]
)
if len(rows) != 1:
Expand Down Expand Up @@ -118,7 +118,8 @@ def e2e_tests(

if clear_tests:
clear_test_logs = dbt_runner.run_operation(
macro_name="elementary_integration_tests.clear_tests", should_log=False
macro_name="elementary_integration_tests.clear_tests",
return_raw_edr_logs=True,
)
for clear_test_log in clear_test_logs:
print(clear_test_log)
Expand All @@ -128,15 +129,14 @@ def e2e_tests(
if "dimension" in test_types:
dbt_runner.run_operation(
macro_name="elementary_integration_tests.create_new_dimension",
should_log=True,
)

if "error_model" in test_types:
results = [
TestResult(type="error_model", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_error_model",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -153,7 +153,7 @@ def e2e_tests(
TestResult(type="seasonal_volume", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_seasonal_volume_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -167,7 +167,7 @@ def e2e_tests(
TestResult(type="table_anomalies", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_table_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -189,7 +189,7 @@ def e2e_tests(
TestResult(type="error_snapshot", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_error_snapshot",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -202,7 +202,7 @@ def e2e_tests(
dbt_runner.run_operation(
macro_name="elementary_integration_tests.return_config_var",
macro_args={"var_name": "days_back"},
should_log=False,
return_raw_edr_logs=True,
)[0]
)
# No need to create today's metric because the validation run does it.
Expand Down Expand Up @@ -241,7 +241,7 @@ def e2e_tests(
TestResult(type="directional_anomalies", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_directional_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -260,7 +260,7 @@ def e2e_tests(
TestResult(type="no_timestamp_anomalies", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_no_timestamp_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -274,7 +274,7 @@ def e2e_tests(
TestResult(type="event_freshness_anomalies", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_event_freshness_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -288,7 +288,7 @@ def e2e_tests(
TestResult(type="column_anomalies", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_column_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -302,7 +302,7 @@ def e2e_tests(
TestResult(type="backfill_days", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_backfill_days",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -316,14 +316,13 @@ def e2e_tests(
TestResult(type="dimension_anomalies", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_dimension_anomalies",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)

dbt_runner.run_operation(
macro_name="elementary_integration_tests.delete_new_dimension",
should_log=True,
)

if "schema" in test_types and target not in ["databricks", "spark"]:
Expand All @@ -335,7 +334,7 @@ def e2e_tests(
TestResult(type="schema_changes", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_schema_changes",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -349,7 +348,7 @@ def e2e_tests(
TestResult(type="regular_tests", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_regular_tests",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -363,7 +362,7 @@ def e2e_tests(
TestResult(type="config_levels", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_config_levels",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -373,7 +372,7 @@ def e2e_tests(
TestResult(type="artifacts", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_dbt_artifacts",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -393,7 +392,7 @@ def e2e_tests(
TestResult(type="error_test", message=msg)
for msg in dbt_runner.run_operation(
macro_name="elementary_integration_tests.validate_error_test",
should_log=False,
return_raw_edr_logs=True,
)
]
test_results.extend(results)
Expand All @@ -416,7 +415,7 @@ def e2e_tests(
message=dbt_runner.run_operation(
"elementary_integration_tests.assert_table_doesnt_exist",
macro_args={"model_name": "non_dbt_model"},
should_log=False,
return_raw_edr_logs=True,
)[0],
)
except ValueError:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/deprecated_tests/run_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run_unit_tests(test_file, target="snowflake"):
print(f"Running unit tests against target - {target}")
for unit_test in unit_tests:
unit_test_results = dbt_runner.run_operation(
macro_name=unit_test, log_errors=True, should_log=False
macro_name=unit_test, log_errors=True, return_raw_edr_logs=True
)
print_unit_test_results(unit_test, unit_test_results)

Expand Down

0 comments on commit 8b21e86

Please sign in to comment.