Skip to content

Commit 7a2e5a5

Browse files
committed
Remove save command - merge handles all use cases
The merge command with a prefix that matches a single file works identically to save, making save redundant. Simplify to two commands: - merge: Read JUnit XML file(s) → save timings - split: Read timings → output test distribution
1 parent ecb03aa commit 7a2e5a5

File tree

3 files changed

+10
-93
lines changed

3 files changed

+10
-93
lines changed

README.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ This tool stores test timings in a local JSON file, keeping the last 10 timings
7676

7777
**Key concepts:**
7878
- **Split phase**: Before tests run, fairsplice distributes test files across workers based on historical timing data
79-
- **Save phase**: After tests complete, fairsplice extracts timing from JUnit XML and updates the timings file
79+
- **Merge phase**: After tests complete, fairsplice extracts timing from JUnit XML and updates the timings file
8080
- **Bin packing**: Tests are assigned to workers to balance total execution time (heaviest tests first)
8181
- **Rolling average**: Keeps last 10 timings per test file, uses average for predictions
8282

@@ -93,28 +93,11 @@ bunx fairsplice
9393

9494
## Usage
9595

96-
Fairsplice supports three commands: `save`, `merge`, and `split`. All require a `--timings-file` parameter to specify where timings are stored.
96+
Fairsplice has two commands: `merge` and `split`. Both require a `--timings-file` parameter.
9797

98-
### Saving test results (single file)
98+
### Merging test results
9999

100-
To save test results from a single JUnit XML file:
101-
102-
```bash
103-
fairsplice save --timings-file <timings.json> --from <junit.xml>
104-
```
105-
106-
- `--timings-file <file>`: JSON file to store timings (will be created if it doesn't exist)
107-
- `--from <file>`: JUnit XML file to read test results from
108-
109-
Example:
110-
111-
```bash
112-
fairsplice save --timings-file timings.json --from results/junit.xml
113-
```
114-
115-
### Merging test results (multiple files)
116-
117-
To merge and save test results from multiple JUnit XML files (e.g., from parallel workers):
100+
Save test timings from JUnit XML file(s):
118101

119102
```bash
120103
fairsplice merge --timings-file <timings.json> --prefix <prefix>
@@ -132,7 +115,7 @@ fairsplice merge --timings-file timings.json --prefix junit-
132115

133116
### Splitting test cases
134117

135-
To split test cases for execution:
118+
Split test files across workers based on historical timings:
136119

137120
```bash
138121
fairsplice split --timings-file <timings.json> --pattern "<pattern>" --total <total> --out <file>

index.ts

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bun
22

33
import { merge } from "./src/commands/merge";
4-
import { save } from "./src/commands/save";
54
import { split } from "./src/commands/split";
65
import { parseArgs } from "util";
76

@@ -16,10 +15,6 @@ const { positionals, values } = parseArgs({
1615
["timings-file"]: {
1716
type: "string",
1817
},
19-
// save options
20-
from: {
21-
type: "string",
22-
},
2318
// merge options
2419
prefix: {
2520
type: "string",
@@ -52,26 +47,15 @@ const command = positionals[2];
5247

5348
if (values.help || !command) {
5449
console.log(`
55-
Usage: fairsplice [save|merge|split] [options]
56-
57-
fairsplice save
58-
---------------
59-
Save test timings from a single JUnit XML file.
60-
61-
Required options:
62-
--timings-file <file> JSON file to store timings
63-
--from <file> JUnit XML file to read test results from
64-
65-
Example: fairsplice save --timings-file timings.json --from results/junit.xml
66-
50+
Usage: fairsplice [merge|split] [options]
6751
6852
fairsplice merge
6953
----------------
70-
Merge and save test timings from multiple JUnit XML files (e.g., from parallel workers).
54+
Save test timings from JUnit XML file(s).
7155
7256
Required options:
7357
--timings-file <file> JSON file to store timings
74-
--prefix <prefix> Prefix to match JUnit XML files (e.g., "junit-" matches junit-0.xml, junit-1.xml)
58+
--prefix <prefix> Prefix to match JUnit XML files (e.g., "junit-" matches junit-*.xml)
7559
7660
Example: fairsplice merge --timings-file timings.json --prefix junit-
7761
@@ -95,16 +79,7 @@ Example: fairsplice split --timings-file timings.json --pattern "test_*.py" --to
9579
process.exit(0);
9680
}
9781

98-
if (command === "save") {
99-
if (!values["timings-file"] || !values.from) {
100-
console.error(
101-
"Error: --timings-file and --from are required for the save command."
102-
);
103-
process.exit(1);
104-
}
105-
await save({ from: values.from, timingsFile: values["timings-file"] });
106-
process.exit(0);
107-
} else if (command === "merge") {
82+
if (command === "merge") {
10883
if (!values["timings-file"] || !values.prefix) {
10984
console.error(
11085
"Error: --timings-file and --prefix are required for the merge command."
@@ -136,7 +111,7 @@ if (command === "save") {
136111
process.exit(0);
137112
} else {
138113
console.error(
139-
`Invalid command "${command}". Available commands: save, merge, split.`
114+
`Invalid command "${command}". Available commands: merge, split.`
140115
);
141116
process.exit(1);
142117
}

src/commands/save.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)