Run ordered processing with independent settings
This commit is contained in:
39
internal/framework/preflight/readiness_test.go
Normal file
39
internal/framework/preflight/readiness_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package preflight
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/config"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/diagnostics"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
||||
)
|
||||
|
||||
func TestLaterEmptyGlossaryFailsBeforeOutputPreparation(t *testing.T) {
|
||||
profile, id := "selected", "spells"
|
||||
cfg := &config.Config{Pipeline: config.Pipeline{Stages: []config.Stage{
|
||||
{Module: "grammar", LLM: config.LLM{ProposalProfile: &profile, ValidationProfile: &profile}},
|
||||
{Module: "glossary", ID: &id, Glossaries: []string{"empty"}, LLM: config.LLM{ProposalProfile: &profile, ValidationProfile: &profile}},
|
||||
}}}
|
||||
output := filepath.Join(t.TempDir(), "transcript.json")
|
||||
calls := 0
|
||||
_, err := Prepare(context.Background(), Input{Config: cfg, Transcript: &schema.SourceTranscript{}, Output: diagnostics.OutputSelection{TranscriptPath: output}, InspectProfile: func(context.Context, string) error { calls++; return nil }})
|
||||
if err == nil || !strings.Contains(err.Error(), "stage 2") || !strings.Contains(err.Error(), "spells") || !strings.Contains(err.Error(), "empty") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if calls != 0 {
|
||||
t.Fatal("inspected profiles before checking all glossary selections")
|
||||
}
|
||||
if _, err := os.Stat(output); !os.IsNotExist(err) {
|
||||
t.Fatalf("output exists: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyPipelineNeedsNoProfile(t *testing.T) {
|
||||
if err := CheckReadiness(context.Background(), &config.Config{}, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user