Promote native Notarius lane products
This commit is contained in:
37
internal/app/extract_fallback_test.go
Normal file
37
internal/app/extract_fallback_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/stage"
|
||||
)
|
||||
|
||||
func TestExtractionFallbackCountInExecutionResults(t *testing.T) {
|
||||
for _, reused := range []bool{false, true} {
|
||||
t.Run(map[bool]string{false: "executed", true: "reused"}[reused], func(t *testing.T) {
|
||||
cfg := testConfig(t)
|
||||
var selected stage.Stage = resultStage{name: "extract", result: &stage.StageResult{Metadata: map[string]any{"completion": map[string]any{"fallback_count": 3}}}}
|
||||
if reused {
|
||||
store := &manifest.LocalStore{}
|
||||
seed := manifest.New(cfg.Session.SessionID, time.Now().UTC())
|
||||
seed.MarkStageSucceeded("extract", time.Now().UTC(), nil)
|
||||
seed.Stages["extract"].Metadata = map[string]any{"completion": map[string]any{"fallback_count": 3}}
|
||||
if err := store.Save(context.Background(), manifestPathFor(cfg), seed); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
runs := 0
|
||||
selected = resumeCheckingStage{name: "extract", validation: stage.Resumable(), runs: &runs}
|
||||
}
|
||||
summary, err := executeStages(context.Background(), cfg, []stage.Stage{selected}, RunOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(summary.StageResults) != 1 || summary.StageResults[0].FallbackCount != 3 {
|
||||
t.Fatalf("stage results = %#v", summary.StageResults)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user