Skip to content

Commit

Permalink
Update tests to handle bumped versions of manifest and run-results
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm committed Dec 1, 2023
1 parent b82d069 commit 9933638
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v6.json", "dbt_version": "1.8.0a1", "generated_at": "2023-12-01T00:27:31.475276Z", "invocation_id": "6dbe790d-e31a-45d3-bf5c-b67232e7e45c", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-01T00:27:31.399416Z", "completed_at": "2023-12-01T00:27:31.406369Z"}, {"name": "execute", "started_at": "2023-12-01T00:27:31.407149Z", "completed_at": "2023-12-01T00:27:31.458669Z"}], "thread_id": "Thread-8", "execution_time": 0.0613861083984375, "adapter_response": {"_message": "CREATE VIEW", "code": "CREATE VIEW", "rows_affected": -1}, "message": "CREATE VIEW", "failures": null, "unique_id": "model.test.metricflow_time_spine", "compiled": true, "compiled_code": "SELECT to_date('02/20/2023', 'mm/dd/yyyy') as date_day", "relation_name": "\"dbt\".\"test17013904484151129162_test_previous_version_state\".\"metricflow_time_spine\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2023-12-01T00:27:31.401527Z", "completed_at": "2023-12-01T00:27:31.402989Z"}, {"name": "execute", "started_at": "2023-12-01T00:27:31.403533Z", "completed_at": "2023-12-01T00:27:31.460610Z"}], "thread_id": "Thread-9", "execution_time": 0.0629112720489502, "adapter_response": {"_message": "CREATE VIEW", "code": "CREATE VIEW", "rows_affected": -1}, "message": "CREATE VIEW", "failures": null, "unique_id": "model.test.my_model", "compiled": true, "compiled_code": "select 1 as id", "relation_name": "\"dbt\".\"test17013904484151129162_test_previous_version_state\".\"my_model\""}], "elapsed_time": 0.5424928665161133, "args": {"log_format_file": "debug", "profiles_dir": "/private/var/folders/79/5290gpvn3lx5jdryk4844rm80000gn/T/pytest-of-quigleymalcolm/pytest-449/profile0", "defer": false, "favor_state": false, "populate_cache": true, "partial_parse": true, "select": [], "show_resource_report": false, "version_check": true, "strict_mode": false, "introspect": true, "project_dir": "/private/var/folders/79/5290gpvn3lx5jdryk4844rm80000gn/T/pytest-of-quigleymalcolm/pytest-449/project0", "indirect_selection": "eager", "vars": {}, "log_level_file": "debug", "log_level": "info", "printer_width": 80, "cache_selected_only": false, "which": "run", "log_path": "/Users/quigleymalcolm/Developer/dbt-labs/dbt-core/logs/test17013904484151129162", "write_json": true, "log_file_max_bytes": 10485760, "macro_debugging": true, "static_parser": true, "enable_legacy_logger": false, "warn_error_options": {"include": [], "exclude": []}, "invocation_command": "dbt tests/functional/artifacts/test_previous_version_state.py", "exclude": [], "use_colors": true, "use_colors_file": true, "quiet": false, "print": true, "send_anonymous_usage_stats": false, "partial_parse_file_diff": true, "log_format": "default"}}
1 change: 1 addition & 0 deletions tests/functional/artifacts/data/state/v12/manifest.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tests/functional/artifacts/test_previous_version_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@


class TestPreviousVersionState:
CURRENT_EXPECTED_MANIFEST_VERSION = 11
CURRENT_EXPECTED_RUN_RESULTS_VERSION = 5
CURRENT_EXPECTED_MANIFEST_VERSION = 12
CURRENT_EXPECTED_RUN_RESULTS_VERSION = 6

@pytest.fixture(scope="class")
def models(self):
Expand Down Expand Up @@ -412,7 +412,7 @@ def test_compare_state_current(self, project):
current_manifest_schema_version == self.CURRENT_EXPECTED_MANIFEST_VERSION
), "Sounds like you've bumped the manifest version and need to update this test!"
# If we need a newly generated manifest, uncomment the following line and commit the result
# self.generate_latest_manifest(project, current_manifest_schema_version)
self.generate_latest_manifest(project, current_manifest_schema_version)
self.compare_previous_state(project, current_manifest_schema_version, True, 0)

def test_backwards_compatible_versions(self, project):
Expand Down Expand Up @@ -443,7 +443,7 @@ def test_compare_results_current(self, project):
current_run_results_schema_version == self.CURRENT_EXPECTED_RUN_RESULTS_VERSION
), "Sounds like you've bumped the run_results version and need to update this test!"
# If we need a newly generated run_results, uncomment the following line and commit the result
# self.generate_latest_run_results(project, current_run_results_schema_version)
self.generate_latest_run_results(project, current_run_results_schema_version)
self.compare_previous_results(project, current_run_results_schema_version, True, 0)

def test_backwards_compatible_run_results_versions(self, project):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def test_no_nodes(self):
"group_map": {},
"metadata": {
"generated_at": "2018-02-14T09:15:13Z",
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json",
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json",
"dbt_version": dbt.version.__version__,
"env": {ENV_KEY_NAME: "value"},
"invocation_id": invocation_id,
Expand Down Expand Up @@ -571,7 +571,7 @@ def test_no_nodes_with_metadata(self, mock_user):
"docs": {},
"metadata": {
"generated_at": "2018-02-14T09:15:13Z",
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json",
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json",
"dbt_version": dbt.version.__version__,
"project_id": "098f6bcd4621d373cade4e832627b4f6",
"user_id": "cfc9500f-dc7f-4c83-9ea7-2c581c1b38cf",
Expand Down Expand Up @@ -913,7 +913,7 @@ def test_no_nodes(self):
"group_map": {},
"metadata": {
"generated_at": "2018-02-14T09:15:13Z",
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json",
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json",
"dbt_version": dbt.version.__version__,
"invocation_id": "01234567-0123-0123-0123-0123456789ab",
"env": {ENV_KEY_NAME: "value"},
Expand Down

0 comments on commit 9933638

Please sign in to comment.