Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 32a4914

Browse files
committed
Tests: Even better balance using TEST_ACROSS_ALL_DBS
1 parent cc12659 commit 32a4914

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ jobs:
5151
DATADIFF_VERTICA_URI: 'vertica://vertica:Password1@localhost:5433/vertica'
5252
run: |
5353
chmod +x tests/waiting_for_stack_up.sh
54-
./tests/waiting_for_stack_up.sh && poetry run unittest-parallel -j 16
54+
./tests/waiting_for_stack_up.sh && TEST_ACROSS_ALL_DBS=0 poetry run unittest-parallel -j 16

.github/workflows/ci_full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
DATADIFF_VERTICA_URI: 'vertica://vertica:Password1@localhost:5433/vertica'
4848
run: |
4949
chmod +x tests/waiting_for_stack_up.sh
50-
./tests/waiting_for_stack_up.sh && FULL_TESTS=1 poetry run unittest-parallel -j 16
50+
./tests/waiting_for_stack_up.sh && TEST_ACROSS_ALL_DBS=full poetry run unittest-parallel -j 16

tests/common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
N_SAMPLES = int(os.environ.get("N_SAMPLES", DEFAULT_N_SAMPLES))
3737
BENCHMARK = os.environ.get("BENCHMARK", False)
3838
N_THREADS = int(os.environ.get("N_THREADS", 1))
39-
FULL_TESTS = bool(os.environ.get("FULL_TESTS", False)) # Should we run the full db<->db test suite?
39+
TEST_ACROSS_ALL_DBS = os.environ.get("TEST_ACROSS_ALL_DBS", True) # Should we run the full db<->db test suite?
4040

4141

4242
def get_git_revision_short_hash() -> str:
@@ -95,8 +95,10 @@ def _print_used_dbs():
9595
logging.info(f"Testing databases: {', '.join(used)}")
9696
if unused:
9797
logging.info(f"Connection not configured; skipping tests for: {', '.join(unused)}")
98-
if FULL_TESTS:
99-
logging.info("Full tests enabled (every db<->db). May take very long when many dbs are involved.")
98+
if TEST_ACROSS_ALL_DBS:
99+
logging.info(
100+
f"Full tests enabled (every db<->db). May take very long when many dbs are involved. ={TEST_ACROSS_ALL_DBS}"
101+
)
100102

101103

102104
_print_used_dbs()

tests/test_database_types.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
N_THREADS,
2626
BENCHMARK,
2727
GIT_REVISION,
28-
FULL_TESTS,
28+
TEST_ACROSS_ALL_DBS,
2929
get_conn,
3030
random_table_suffix,
3131
)
@@ -420,27 +420,29 @@ def __iter__(self):
420420
}
421421

422422

423-
def _get_test_db_pairs(full):
424-
if full:
423+
def _get_test_db_pairs():
424+
if str(TEST_ACROSS_ALL_DBS).lower() == "full":
425425
for source_db in DATABASE_TYPES:
426426
for target_db in DATABASE_TYPES:
427427
yield source_db, target_db
428-
else:
428+
elif int(TEST_ACROSS_ALL_DBS):
429429
for db_cls in DATABASE_TYPES:
430430
yield db_cls, db.PostgreSQL
431431
yield db.PostgreSQL, db_cls
432432
yield db_cls, db.Snowflake
433433
yield db.Snowflake, db_cls
434+
else:
435+
yield db.PostgreSQL, db.PostgreSQL
434436

435437

436-
def get_test_db_pairs(full=True):
437-
active_pairs = {(db1, db2) for db1, db2 in _get_test_db_pairs(full) if db1 in CONN_STRINGS and db2 in CONN_STRINGS}
438+
def get_test_db_pairs():
439+
active_pairs = {(db1, db2) for db1, db2 in _get_test_db_pairs() if db1 in CONN_STRINGS and db2 in CONN_STRINGS}
438440
for db1, db2 in active_pairs:
439441
yield db1, DATABASE_TYPES[db1], db2, DATABASE_TYPES[db2]
440442

441443

442444
type_pairs = []
443-
for source_db, source_type_categories, target_db, target_type_categories in get_test_db_pairs(FULL_TESTS):
445+
for source_db, source_type_categories, target_db, target_type_categories in get_test_db_pairs():
444446
for type_category, source_types in source_type_categories.items(): # int, datetime, ..
445447
for source_type in source_types:
446448
for target_type in target_type_categories[type_category]:

0 commit comments

Comments
 (0)