Skip to content

Commit 3912933

Browse files
committed
tests: Sort files before sharding
1 parent 7297741 commit 3912933

File tree

9 files changed

+41
-33
lines changed

9 files changed

+41
-33
lines changed

test/cloudtest/test_full_testdrive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def test_full_testdrive(mz: MaterializeApplication) -> None:
2424
parser.add_argument("--file-pattern", default="*.td", type=str)
2525
args, _ = parser.parse_known_args()
2626

27-
matching_files = glob.glob(
28-
f"testdrive/{args.file_pattern}", root_dir=MZ_ROOT / "test"
27+
matching_files = sorted(
28+
glob.glob(f"testdrive/{args.file_pattern}", root_dir=MZ_ROOT / "test")
2929
)
3030

3131
# TODO: database-issues#7827 (test requires fivetran running in cloudtest)

test/kafka-auth/mzcompose.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,14 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
271271
)
272272

273273
files = buildkite.shard_list(
274-
[
275-
file
276-
for file in glob.glob(
277-
f"test-{args.filter}.td", root_dir=MZ_ROOT / "test" / "kafka-auth"
278-
)
279-
],
274+
sorted(
275+
[
276+
file
277+
for file in glob.glob(
278+
f"test-{args.filter}.td", root_dir=MZ_ROOT / "test" / "kafka-auth"
279+
)
280+
]
281+
),
280282
lambda file: file,
281283
)
282284
c.test_parts(files, c.run_testdrive_files)

test/mysql-cdc-old-syntax/mzcompose.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def workflow_cdc(c: Composition, parser: WorkflowArgumentParser) -> None:
119119
matching_files.extend(
120120
glob.glob(filter, root_dir=MZ_ROOT / "test" / "mysql-cdc-old-syntax")
121121
)
122-
sharded_files: list[str] = sorted(
123-
buildkite.shard_list(matching_files, lambda file: file)
122+
sharded_files: list[str] = buildkite.shard_list(
123+
sorted(matching_files), lambda file: file
124124
)
125125
print(f"Files: {sharded_files}")
126126

@@ -310,9 +310,8 @@ def workflow_migration(c: Composition, parser: WorkflowArgumentParser) -> None:
310310
matching_files.extend(
311311
glob.glob(filter, root_dir=MZ_ROOT / "test" / "mysql-cdc-old-syntax")
312312
)
313-
314-
sharded_files: list[str] = sorted(
315-
buildkite.shard_list(matching_files, lambda file: file)
313+
sharded_files: list[str] = buildkite.shard_list(
314+
sorted(matching_files), lambda file: file
316315
)
317316
print(f"Files: {sharded_files}")
318317

test/mysql-cdc/mzcompose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def workflow_cdc(c: Composition, parser: WorkflowArgumentParser) -> None:
108108
matching_files.extend(
109109
glob.glob(filter, root_dir=MZ_ROOT / "test" / "mysql-cdc")
110110
)
111-
sharded_files: list[str] = sorted(
112-
buildkite.shard_list(matching_files, lambda file: file)
111+
sharded_files: list[str] = buildkite.shard_list(
112+
sorted(matching_files), lambda file: file
113113
)
114114
print(f"Files: {sharded_files}")
115115

test/pg-cdc-old-syntax/mzcompose.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ def workflow_cdc(c: Composition, parser: WorkflowArgumentParser) -> None:
309309
matching_files.extend(
310310
glob.glob(filter, root_dir=MZ_ROOT / "test" / "pg-cdc-old-syntax")
311311
)
312-
sharded_files: list[str] = sorted(
313-
buildkite.shard_list(matching_files, lambda file: file)
312+
sharded_files: list[str] = buildkite.shard_list(
313+
sorted(matching_files), lambda file: file
314314
)
315315
print(f"Files: {sharded_files}")
316316

@@ -391,8 +391,8 @@ def workflow_migration(c: Composition, parser: WorkflowArgumentParser) -> None:
391391
matching_files.extend(
392392
glob.glob(filter, root_dir=MZ_ROOT / "test" / "pg-cdc-old-syntax")
393393
)
394-
sharded_files: list[str] = sorted(
395-
buildkite.shard_list(matching_files, lambda file: file)
394+
sharded_files: list[str] = buildkite.shard_list(
395+
sorted(matching_files), lambda file: file
396396
)
397397
print(f"Files: {sharded_files}")
398398

test/pg-cdc/mzcompose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ def workflow_cdc(c: Composition, parser: WorkflowArgumentParser) -> None:
295295
matching_files = []
296296
for filter in args.filter:
297297
matching_files.extend(glob.glob(filter, root_dir=MZ_ROOT / "test" / "pg-cdc"))
298-
sharded_files: list[str] = sorted(
299-
buildkite.shard_list(matching_files, lambda file: file)
298+
sharded_files: list[str] = buildkite.shard_list(
299+
sorted(matching_files), lambda file: file
300300
)
301301
print(f"Files: {sharded_files}")
302302

test/secrets-logging/mzcompose.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ def process(file: str) -> None:
7575
)
7676

7777
files = buildkite.shard_list(
78-
[
79-
file
80-
for pattern in args.files
81-
for file in glob.glob(
82-
pattern, root_dir=MZ_ROOT / "test" / "secrets-logging"
83-
)
84-
],
78+
sorted(
79+
[
80+
file
81+
for pattern in args.files
82+
for file in glob.glob(
83+
pattern, root_dir=MZ_ROOT / "test" / "secrets-logging"
84+
)
85+
]
86+
),
8587
lambda file: file,
8688
)
8789
c.test_parts(files, process)

test/testdrive-old-kafka-src-syntax/mzcompose.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ def workflow_migration(c: Composition, parser: WorkflowArgumentParser) -> None:
308308
for file in matching_files
309309
if file != "session.td" and file != "status-history.td"
310310
]
311+
matching_files = sorted(matching_files)
311312

312313
dependencies = [
313314
"fivetran-destination",

test/testdrive/mzcompose.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,15 @@ def process(file: str) -> None:
230230
os.remove(f"test/testdrive/{junit_report}")
231231

232232
files = buildkite.shard_list(
233-
[
234-
file
235-
for pattern in args.files
236-
for file in glob.glob(pattern, root_dir=MZ_ROOT / "test" / "testdrive")
237-
],
233+
sorted(
234+
[
235+
file
236+
for pattern in args.files
237+
for file in glob.glob(
238+
pattern, root_dir=MZ_ROOT / "test" / "testdrive"
239+
)
240+
]
241+
),
238242
lambda file: file,
239243
)
240244
c.test_parts(files, process)

0 commit comments

Comments
 (0)