From 9c065951e77700d4f890d691abf87166c4745e83 Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Thu, 9 May 2024 13:43:31 +0100 Subject: [PATCH] fix: tests on database, dataset, saved_queries apis (#28397) --- scripts/tests/run.sh | 2 +- tests/integration_tests/databases/api_tests.py | 9 +++++++++ tests/integration_tests/datasets/api_tests.py | 2 ++ .../integration_tests/queries/saved_queries/api_tests.py | 1 + tests/unit_tests/databases/api_test.py | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/tests/run.sh b/scripts/tests/run.sh index 88fa41d44bd94..d77adc08e0b4d 100755 --- a/scripts/tests/run.sh +++ b/scripts/tests/run.sh @@ -138,5 +138,5 @@ fi if [ $RUN_TESTS -eq 1 ] then - pytest --durations=0 --maxfail=1 "${TEST_MODULE}" + pytest -vv --durations=0 "${TEST_MODULE}" fi diff --git a/tests/integration_tests/databases/api_tests.py b/tests/integration_tests/databases/api_tests.py index 830625a1545da..520a068d448f0 100644 --- a/tests/integration_tests/databases/api_tests.py +++ b/tests/integration_tests/databases/api_tests.py @@ -194,6 +194,7 @@ def test_get_items(self): "allow_cvas", "allow_dml", "allow_file_upload", + "allow_multi_catalog", "allow_run_async", "allows_cost_estimate", "allows_subquery", @@ -3256,6 +3257,7 @@ def test_available(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "postgresql://user:password@host:port/dbname[?key=value&key=value...]", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": True, "disable_ssh_tunneling": False, }, }, @@ -3279,6 +3281,7 @@ def test_available(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "bigquery://{project_id}", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": True, }, }, @@ -3334,6 +3337,7 @@ def test_available(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "redshift+psycopg2://user:password@host:port/dbname[?key=value&key=value...]", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": False, }, }, @@ -3357,6 +3361,7 @@ def test_available(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "gsheets://", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": True, }, }, @@ -3412,6 +3417,7 @@ def test_available(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "mysql://user:password@host:port/dbname[?key=value&key=value...]", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": False, }, }, @@ -3423,6 +3429,7 @@ def test_available(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "engine+driver://user:password@host:port/dbname[?key=value&key=value...]", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": False, }, }, @@ -3455,6 +3462,7 @@ def test_available_no_default(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "mysql://user:password@host:port/dbname[?key=value&key=value...]", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": False, }, }, @@ -3466,6 +3474,7 @@ def test_available_no_default(self, app, get_available_engine_specs): "sqlalchemy_uri_placeholder": "engine+driver://user:password@host:port/dbname[?key=value&key=value...]", "engine_information": { "supports_file_upload": True, + "supports_dynamic_catalog": False, "disable_ssh_tunneling": False, }, }, diff --git a/tests/integration_tests/datasets/api_tests.py b/tests/integration_tests/datasets/api_tests.py index 0a11732ad160a..543a834793bdd 100644 --- a/tests/integration_tests/datasets/api_tests.py +++ b/tests/integration_tests/datasets/api_tests.py @@ -243,6 +243,7 @@ def test_get_dataset_list(self): response = json.loads(rv.data.decode("utf-8")) assert response["count"] == 1 expected_columns = [ + "catalog", "changed_by", "changed_by_name", "changed_on_delta_humanized", @@ -368,6 +369,7 @@ def test_get_dataset_item(self): "cache_timeout": None, "database": { "backend": main_db.backend, + "allow_multi_catalog": False, "database_name": "examples", "id": 1, }, diff --git a/tests/integration_tests/queries/saved_queries/api_tests.py b/tests/integration_tests/queries/saved_queries/api_tests.py index 6e5ed9abbf7ec..7c51bb8b4a87f 100644 --- a/tests/integration_tests/queries/saved_queries/api_tests.py +++ b/tests/integration_tests/queries/saved_queries/api_tests.py @@ -517,6 +517,7 @@ def test_get_saved_query(self): expected_result = { "id": saved_query.id, + "catalog": None, "database": {"id": saved_query.database.id, "database_name": "examples"}, "description": "cool description", "changed_by": None, diff --git a/tests/unit_tests/databases/api_test.py b/tests/unit_tests/databases/api_test.py index f3f556e2eff4f..86c20935d7979 100644 --- a/tests/unit_tests/databases/api_test.py +++ b/tests/unit_tests/databases/api_test.py @@ -237,6 +237,7 @@ def test_database_connection( "driver": "gsheets", "engine_information": { "disable_ssh_tunneling": True, + "supports_dynamic_catalog": False, "supports_file_upload": True, }, "expose_in_sqllab": True, @@ -308,6 +309,7 @@ def test_database_connection( "driver": "gsheets", "engine_information": { "disable_ssh_tunneling": True, + "supports_dynamic_catalog": False, "supports_file_upload": True, }, "expose_in_sqllab": True,