From 8b21e865a914a6af976be2cb0ca77d3abdd4490c Mon Sep 17 00:00:00 2001 From: Itamar Hartstein Date: Sun, 7 Jul 2024 17:48:18 +0300 Subject: [PATCH] fix deprecated tests (#733) --- .../deprecated_tests/run_e2e_tests.py | 41 +++++++++---------- .../deprecated_tests/run_unit_tests.py | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/integration_tests/deprecated_tests/run_e2e_tests.py b/integration_tests/deprecated_tests/run_e2e_tests.py index 61186d943..3ec72a21d 100644 --- a/integration_tests/deprecated_tests/run_e2e_tests.py +++ b/integration_tests/deprecated_tests/run_e2e_tests.py @@ -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: @@ -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) @@ -128,7 +129,6 @@ 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: @@ -136,7 +136,7 @@ def e2e_tests( 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) @@ -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) @@ -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) @@ -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) @@ -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. @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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"]: @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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: diff --git a/integration_tests/deprecated_tests/run_unit_tests.py b/integration_tests/deprecated_tests/run_unit_tests.py index 6fb340d53..c08a077ee 100644 --- a/integration_tests/deprecated_tests/run_unit_tests.py +++ b/integration_tests/deprecated_tests/run_unit_tests.py @@ -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)