Isolate runner object store construction

This commit is contained in:
2026-09-04 13:01:00 +00:00
parent 2e69c14898
commit 6a15052d77
4 changed files with 35 additions and 17 deletions

View File

@@ -1272,8 +1272,6 @@ func TestExecutePublishLoadsRemoteLocks(t *testing.T) {
fake := &storage.FakeBackend{}
lockKey := artifacts.S3SessionLocksKey(artifacts.S3SessionPrefix("dnd", "sample-campaign", "2026-05-03"))
fake.SeedObject(storage.FakeObject{Key: lockKey, Data: []byte("locks:\n - source: narratio.transcript.final_trimmed\n reason: remote review\n")})
var storeInitCalls int
restoreAppConfigTestGlobals(t, fake, &storeInitCalls, []string{sessionPath})
workRoot := filepath.Join(workspaceRoot, "work", "sample-campaign", "2026-05-03")
mustWriteTestFile(t, filepath.Join(workRoot, "transcripts", "final.trimmed.json"), `{"segments":[]}`)
@@ -1304,10 +1302,25 @@ func TestExecutePublishLoadsRemoteLocks(t *testing.T) {
}
var stdout bytes.Buffer
var stderr bytes.Buffer
code := Execute([]string{"run-stage", "publish", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath, "--force"}, &stdout, &stderr)
if code != 0 {
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
var storeInitCalls int
err = runStageWithPipelineExecutor(
context.Background(),
[]string{"publish", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath, "--force"},
&stdout,
func(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions) (*RunSummary, error) {
return executePlanWithDependencies(ctx, cfg, plan, opts, invocationDependencies{
newObjectStore: func(context.Context, *config.Config) (storage.ObjectStore, error) {
storeInitCalls++
return fake, nil
},
})
},
)
if err != nil {
t.Fatalf("runStageWithPipelineExecutor() error = %v", err)
}
if storeInitCalls != 1 {
t.Fatalf("object store initialization calls = %d, want 1", storeInitCalls)
}
publishedKey := artifacts.S3PublishedOutputKey(artifacts.S3SessionPrefix("dnd", "sample-campaign", "2026-05-03"), "transcripts/final.trimmed.json")
if _, ok := fake.Objects[publishedKey]; ok {