Skip to content

Commit 28e0765

Browse files
committed
test(apilive): run the provenance assertions as subtests
The subtest gate caught a loop the reader tests added: a range over the strings a provenance line must contain, asserting without opening one subtest per case. Each of those strings is a separate claim about what a reader needs from that line, so a failure should name which one is missing rather than which loop failed. That is the whole reason for the rule.
1 parent e040941 commit 28e0765

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,9 @@ and is never logged. Full details: [PRIVACY.md](PRIVACY.md).
468468
| Category | Files | Lines |
469469
| ------------------------ | --------: | ----------: |
470470
| Source (`.go`, non-test) | 1,238 | 261,151 |
471-
| Unit tests (`_test.go`) | 726 | 424,800 |
471+
| Unit tests (`_test.go`) | 726 | 424,803 |
472472
| End-to-end tests | 246 | 66,332 |
473-
| **Total** | **2,210** | **752,283** |
473+
| **Total** | **2,210** | **752,286** |
474474

475475
### Functions
476476

@@ -480,7 +480,7 @@ and is never logged. Full details: [PRIVACY.md](PRIVACY.md).
480480
| . Exported (public) | 2,989 |
481481
| . Unexported (private) | 6,607 |
482482
| Unit test functions (`TestXxx`) | 14,434 |
483-
| Subtests (`t.Run(...)`) | 5,776 |
483+
| Subtests (`t.Run(...)`) | 5,777 |
484484
| End-to-end test functions | 605 |
485485

486486
### Ratios worth noting

cmd/internal/apilive/join_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,12 @@ func TestSourceString_TheProvenanceLineAGateReports(t *testing.T) {
389389
}.String()
390390

391391
for _, want := range []string{"582 entities", "7317 fields", "2110 routes", "264 licensed features", "19.3.1-ee", "2026-09-09"} {
392-
if !strings.Contains(line, want) {
393-
t.Errorf("provenance line %q is missing %q", line, want)
394-
}
392+
t.Run(want, func(t *testing.T) {
393+
t.Parallel()
394+
if !strings.Contains(line, want) {
395+
t.Errorf("provenance line %q is missing %q", line, want)
396+
}
397+
})
395398
}
396399
}
397400

0 commit comments

Comments
 (0)