Separate runner working state from returned results

This commit is contained in:
2026-11-26 02:04:05 +00:00
parent b0dc84a479
commit d1421a710f
15 changed files with 72 additions and 47 deletions

View File

@@ -47,7 +47,7 @@ func TestRunnerChecksCurrentSourceOnConcurrentCacheHits(t *testing.T) {
}
for run := 0; run < 2; run++ {
// The filesystem store is concurrency-safe; its counting test wrapper is not.
output, err := New().Run(context.Background(), RunInput{Prepared: prepared, Cache: cache.inner, RawInput: []byte("input"), Workers: chunkCount})
output, err := New().run(context.Background(), RunInput{Prepared: prepared, Cache: cache.inner, RawInput: []byte("input"), Workers: chunkCount})
if err != nil || len(output.normalizeOutputs) != 2 {
t.Fatalf("run %d: outputs=%d error=%v", run, len(output.normalizeOutputs), err)
}
@@ -101,7 +101,7 @@ func TestRunnerReusesAcceptedPredecessorAfterDownstreamFailure(t *testing.T) {
t.Fatalf("predecessor not stored before downstream failure: calls %d reads/writes %d/%d", calls, store.reads, store.writes)
}
first = false
output, err := New().Run(context.Background(), input)
output, err := New().run(context.Background(), input)
if err != nil || len(output.normalizeOutputs) != 2 || calls != 1 || store.reads != 2 || store.writes != 1 || output.FallbackCount != 0 {
t.Fatalf("rerun=%v outputs=%d calls=%d cache=%d/%d", err, len(output.normalizeOutputs), calls, store.reads, store.writes)
}
@@ -129,7 +129,7 @@ func TestRunnerCacheWarningsDoNotFailSuccessfulPublication(t *testing.T) {
catalog := typedResolutionCatalog(t, completeTypedCatalogOptions())
profile := typedResolutionProfile()
profile.Artifacts = map[string]ArtifactLaneProfile{"notes": registerRunnerNotes(t, catalog, runnerNotesProducer{name: "native", probe: newRunnerProbe(), native: true})}
output, err := New().Run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, engine), RawInput: []byte("input"), Cache: store, Workers: 1})
output, err := New().run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, engine), RawInput: []byte("input"), Cache: store, Workers: 1})
if err != nil || len(output.normalizeOutputs) != 1 || output.FallbackCount != 0 {
t.Fatalf("cache warnings failed successful work: %v, outputs=%d", err, len(output.normalizeOutputs))
}
@@ -311,7 +311,7 @@ func TestRunnerCachesAppliedMergeAndNormalizationArtifacts(t *testing.T) {
}
}
for range 2 {
output, err := New().Run(context.Background(), RunInput{Prepared: prepared, Cache: store, RawInput: []byte("input"), Workers: 1})
output, err := New().run(context.Background(), RunInput{Prepared: prepared, Cache: store, RawInput: []byte("input"), Workers: 1})
if err != nil || len(output.normalizeOutputs) != 2 {
t.Fatalf("cached %s execution: %v, outputs %d", role, err, len(output.normalizeOutputs))
}