Skip to content

Commit a6970c8

Browse files
authored
chore(firestore): remove named database duplication in system tests (#17442)
This PR reduces system test execution time by removing redundant test sweeps across identical standard databases.
1 parent ab01ffa commit a6970c8

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

packages/google-cloud-firestore/tests/system/test__helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
FIRESTORE_OTHER_DB = os.environ.get("SYSTEM_TESTS_DATABASE", "system-tests-named-db")
2323
FIRESTORE_ENTERPRISE_DB = os.environ.get("ENTERPRISE_DATABASE", "enterprise-db-native")
2424

25-
# run all tests against default database, and a named database
26-
TEST_DATABASES = [None, FIRESTORE_OTHER_DB]
25+
# To eliminate test duplication, we use the default database for the
26+
# core test suites. The named database is ONLY tested explicitly in dedicated
27+
# routing tests to prove path construction works.
28+
TEST_DATABASES = [None]
2729
TEST_DATABASES_W_ENTERPRISE = TEST_DATABASES + [FIRESTORE_ENTERPRISE_DB]
2830

2931

packages/google-cloud-firestore/tests/system/test_system.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
FIRESTORE_CREDS,
3737
FIRESTORE_EMULATOR,
3838
FIRESTORE_ENTERPRISE_DB,
39+
FIRESTORE_OTHER_DB,
3940
FIRESTORE_PROJECT,
4041
MISSING_DOCUMENT,
4142
RANDOM_ID_REGEX,
@@ -1067,7 +1068,9 @@ def check_snapshot(snapshot, document, data, write_result):
10671068
assert snapshot.update_time == write_result.update_time
10681069

10691070

1070-
@pytest.mark.parametrize("database", TEST_DATABASES, indirect=True)
1071+
# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test
1072+
# named database path routing natively, without inflating the rest of the test suite.
1073+
@pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True)
10711074
def test_document_get(client, cleanup, database):
10721075
now = datetime.datetime.now(tz=datetime.timezone.utc)
10731076
document_id = "for-get" + UNIQUE_RESOURCE_ID

packages/google-cloud-firestore/tests/system/test_system_async.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
FIRESTORE_CREDS,
4040
FIRESTORE_EMULATOR,
4141
FIRESTORE_ENTERPRISE_DB,
42+
FIRESTORE_OTHER_DB,
4243
FIRESTORE_PROJECT,
4344
MISSING_DOCUMENT,
4445
RANDOM_ID_REGEX,
@@ -1046,7 +1047,9 @@ def check_snapshot(snapshot, document, data, write_result):
10461047
assert snapshot.update_time == write_result.update_time
10471048

10481049

1049-
@pytest.mark.parametrize("database", TEST_DATABASES, indirect=True)
1050+
# We explicitly parameterize test_document_get with FIRESTORE_OTHER_DB to test
1051+
# named database path routing natively, without inflating the rest of the test suite.
1052+
@pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True)
10501053
async def test_document_get(client, cleanup, database):
10511054
now = datetime.datetime.now(tz=datetime.timezone.utc)
10521055
document_id = "for-get" + UNIQUE_RESOURCE_ID

0 commit comments

Comments
 (0)