From 4bfec87cdbfa04f7c9302e3246ad34220960a69b Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 12 Jun 2026 04:16:30 +0000 Subject: [PATCH 1/2] chore(firestore): remove named database duplication in system tests --- .../google-cloud-firestore/tests/system/test__helpers.py | 6 ++++-- packages/google-cloud-firestore/tests/system/test_system.py | 5 ++++- .../tests/system/test_system_async.py | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-firestore/tests/system/test__helpers.py b/packages/google-cloud-firestore/tests/system/test__helpers.py index 228bd0e4362a..2c8256426dc5 100644 --- a/packages/google-cloud-firestore/tests/system/test__helpers.py +++ b/packages/google-cloud-firestore/tests/system/test__helpers.py @@ -22,8 +22,10 @@ FIRESTORE_OTHER_DB = os.environ.get("SYSTEM_TESTS_DATABASE", "system-tests-named-db") FIRESTORE_ENTERPRISE_DB = os.environ.get("ENTERPRISE_DATABASE", "enterprise-db-native") -# run all tests against default database, and a named database -TEST_DATABASES = [None, FIRESTORE_OTHER_DB] +# To eliminate test duplication, we use the default database for the +# core test suites. The named database is ONLY tested explicitly in dedicated +# routing tests to prove path construction works. +TEST_DATABASES = [None] TEST_DATABASES_W_ENTERPRISE = TEST_DATABASES + [FIRESTORE_ENTERPRISE_DB] diff --git a/packages/google-cloud-firestore/tests/system/test_system.py b/packages/google-cloud-firestore/tests/system/test_system.py index fe475206d37f..c3b632e64485 100644 --- a/packages/google-cloud-firestore/tests/system/test_system.py +++ b/packages/google-cloud-firestore/tests/system/test_system.py @@ -36,6 +36,7 @@ FIRESTORE_CREDS, FIRESTORE_EMULATOR, FIRESTORE_ENTERPRISE_DB, + FIRESTORE_OTHER_DB, FIRESTORE_PROJECT, MISSING_DOCUMENT, RANDOM_ID_REGEX, @@ -1064,7 +1065,9 @@ def check_snapshot(snapshot, document, data, write_result): assert snapshot.update_time == write_result.update_time -@pytest.mark.parametrize("database", TEST_DATABASES, indirect=True) +# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test +# named database path routing natively, without inflating the rest of the test suite. +@pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True) def test_document_get(client, cleanup, database): now = datetime.datetime.now(tz=datetime.timezone.utc) document_id = "for-get" + UNIQUE_RESOURCE_ID diff --git a/packages/google-cloud-firestore/tests/system/test_system_async.py b/packages/google-cloud-firestore/tests/system/test_system_async.py index ef8ca5b84d5f..3c157be9b7d7 100644 --- a/packages/google-cloud-firestore/tests/system/test_system_async.py +++ b/packages/google-cloud-firestore/tests/system/test_system_async.py @@ -39,6 +39,7 @@ FIRESTORE_CREDS, FIRESTORE_EMULATOR, FIRESTORE_ENTERPRISE_DB, + FIRESTORE_OTHER_DB, FIRESTORE_PROJECT, MISSING_DOCUMENT, RANDOM_ID_REGEX, @@ -1046,7 +1047,9 @@ def check_snapshot(snapshot, document, data, write_result): assert snapshot.update_time == write_result.update_time -@pytest.mark.parametrize("database", TEST_DATABASES, indirect=True) +# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test +# named database path routing natively, without inflating the rest of the test suite. +@pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True) async def test_document_get(client, cleanup, database): now = datetime.datetime.now(tz=datetime.timezone.utc) document_id = "for-get" + UNIQUE_RESOURCE_ID From a95b83533c297c99b6357b643afae664c8b17e8b Mon Sep 17 00:00:00 2001 From: ohmayr Date: Fri, 12 Jun 2026 05:40:37 +0000 Subject: [PATCH 2/2] fix lint --- packages/google-cloud-firestore/tests/system/test__helpers.py | 4 ++-- packages/google-cloud-firestore/tests/system/test_system.py | 2 +- .../google-cloud-firestore/tests/system/test_system_async.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-firestore/tests/system/test__helpers.py b/packages/google-cloud-firestore/tests/system/test__helpers.py index 2c8256426dc5..9492fde92b6a 100644 --- a/packages/google-cloud-firestore/tests/system/test__helpers.py +++ b/packages/google-cloud-firestore/tests/system/test__helpers.py @@ -22,8 +22,8 @@ FIRESTORE_OTHER_DB = os.environ.get("SYSTEM_TESTS_DATABASE", "system-tests-named-db") FIRESTORE_ENTERPRISE_DB = os.environ.get("ENTERPRISE_DATABASE", "enterprise-db-native") -# To eliminate test duplication, we use the default database for the -# core test suites. The named database is ONLY tested explicitly in dedicated +# To eliminate test duplication, we use the default database for the +# core test suites. The named database is ONLY tested explicitly in dedicated # routing tests to prove path construction works. TEST_DATABASES = [None] TEST_DATABASES_W_ENTERPRISE = TEST_DATABASES + [FIRESTORE_ENTERPRISE_DB] diff --git a/packages/google-cloud-firestore/tests/system/test_system.py b/packages/google-cloud-firestore/tests/system/test_system.py index c3b632e64485..3a28e8f04e2d 100644 --- a/packages/google-cloud-firestore/tests/system/test_system.py +++ b/packages/google-cloud-firestore/tests/system/test_system.py @@ -1065,7 +1065,7 @@ def check_snapshot(snapshot, document, data, write_result): assert snapshot.update_time == write_result.update_time -# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test +# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test # named database path routing natively, without inflating the rest of the test suite. @pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True) def test_document_get(client, cleanup, database): diff --git a/packages/google-cloud-firestore/tests/system/test_system_async.py b/packages/google-cloud-firestore/tests/system/test_system_async.py index 3c157be9b7d7..2d6530bf2aae 100644 --- a/packages/google-cloud-firestore/tests/system/test_system_async.py +++ b/packages/google-cloud-firestore/tests/system/test_system_async.py @@ -1047,7 +1047,7 @@ def check_snapshot(snapshot, document, data, write_result): assert snapshot.update_time == write_result.update_time -# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test +# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test # named database path routing natively, without inflating the rest of the test suite. @pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True) async def test_document_get(client, cleanup, database):