Parallelize the new ULID id tests · Entire
Parallelize the new ULID id tests
8ce9471→main·
Soph·2w ago·1 file·+9 added/-0 removed
Address Copilot review on #1546: the new id tests are pure (no process-global state), so add t.Parallel() to them and their subtests, matching the repo convention (e.g. trailers_test.go). Pre-existing non-parallel tests in this file are left as-is (out of scope).
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
d4a92fb76b8eView transcript
[?
Build Checkpoints Store Based on DesignClaude Code·2 steps](/content/gh/entireio/cli/session/6852b33a-0d22-4364-aa6c-8de706ecc215#timeline-d4a92fb76b8e/index.html)
Changes
1
cmd/entire/cli/checkpoint/id
Mid_test.go+9
115 unmodified lines
116
117
118
119
120
121
122
15 unmodified lines
138
139
140
141
142
143
144
5 unmodified lines
150
151
152
153
154
155
156
15 unmodified lines
172
173
174
175
176
177
178
2 unmodified lines
181
182
183
184
185
186
187
6 unmodified lines
194
195
196
197
198
199
200
201
202
11 unmodified lines
214
215
216
217
218
219
220
4 unmodified lines
225
226
227
228
229
230
231
115 unmodified lines
}
func TestKindOf(t *testing.T) {
t.Parallel()
tests := []struct {
name string
input string
15 unmodified lines
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := KindOf(tt.input); got != tt.want {
t.Errorf("KindOf(%q) = %v, want %v", tt.input, got, tt.want)
}
5 unmodified lines
}
func TestCheckpointID_ShardFor(t *testing.T) {
t.Parallel()
tests := []struct {
name string
input string
15 unmodified lines
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CheckpointID(tt.input).ShardFor(); got != tt.want {
t.Errorf("CheckpointID(%q).ShardFor() = %q, want %q", tt.input, got, tt.want)
}
2 unmodified lines
}
func TestValidateAcceptsBothFormats(t *testing.T) {
t.Parallel()
if err := Validate("a1b2c3d4e5f6"); err != nil {
t.Errorf("Validate(legacy hex) = %v, want nil", err)
}
6 unmodified lines
}
func TestUnmarshalJSON_ULIDRoundTrip(t *testing.T) {
t.Parallel()
t.Run("ULID round-trips", func(t *testing.T) {
t.Parallel()
var id CheckpointID
if err := json.Unmarshal([]byte(`"+sampleULID+`"), &id); err != nil {
t.Fatalf("unmarshal ULID: %v", err)
11 unmodified lines
})
t.Run("empty string is EmptyCheckpointID", func(t *testing.T) {
t.Parallel()
var id CheckpointID
if err := json.Unmarshal([]byte(`""`), &id); err != nil {
t.Fatalf("unmarshal empty: %v", err)
4 unmodified lines
})
t.Run("invalid string still rejected", func(t *testing.T) {
t.Parallel()
var id CheckpointID
if err := json.Unmarshal([]byte(`"not-a-valid-id"`), &id); err == nil {
t.Error("expected error unmarshalling invalid checkpoint ID, got nil")