Harden initial framework skeleton
This commit is contained in:
@@ -51,7 +51,7 @@ inputs:
|
||||
autocorrect_file: ./autocorrect.yml
|
||||
glossary_file: ./glossary.yml
|
||||
`,
|
||||
wantLoadErr: "field bogus not found",
|
||||
wantLoadErr: "pipeline file",
|
||||
},
|
||||
{
|
||||
name: "unknown session field fails",
|
||||
@@ -66,7 +66,7 @@ inputs:
|
||||
glossary_file: ./glossary.yml
|
||||
unknown_field: true
|
||||
`,
|
||||
wantLoadErr: "field unknown_field not found",
|
||||
wantLoadErr: "session file",
|
||||
},
|
||||
{
|
||||
name: "missing required field fails",
|
||||
@@ -80,7 +80,7 @@ inputs:
|
||||
autocorrect_file: ./autocorrect.yml
|
||||
glossary_file: ./glossary.yml
|
||||
`,
|
||||
wantValidate: "session.session_id is required",
|
||||
wantValidate: "session config \"session.yml\" invalid: session.session_id is required",
|
||||
},
|
||||
{
|
||||
name: "invalid timeout fails",
|
||||
@@ -96,7 +96,7 @@ inputs:
|
||||
autocorrect_file: ./autocorrect.yml
|
||||
glossary_file: ./glossary.yml
|
||||
`,
|
||||
wantValidate: "pipeline.whisperx.timeout must be a valid duration",
|
||||
wantValidate: "pipeline config \"pipeline.yml\" invalid: pipeline.whisperx.timeout must be a valid duration",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -112,6 +112,9 @@ inputs:
|
||||
if !strings.Contains(err.Error(), tt.wantLoadErr) {
|
||||
t.Fatalf("load error = %q, want to contain %q", err.Error(), tt.wantLoadErr)
|
||||
}
|
||||
if !strings.Contains(err.Error(), "strict decode failed") {
|
||||
t.Fatalf("load error = %q, want strict decode context", err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -162,6 +165,22 @@ func TestValidateMissingAudioSource(t *testing.T) {
|
||||
if !strings.Contains(err.Error(), "audio_dir or at least one audio_files") {
|
||||
t.Fatalf("error = %q, want audio source guidance", err.Error())
|
||||
}
|
||||
if !strings.Contains(err.Error(), "session config") {
|
||||
t.Fatalf("error = %q, want session config context", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestExamplesLoadAndValidate(t *testing.T) {
|
||||
pipelinePath := filepath.Join("..", "..", "examples", "pipeline.minimal.yml")
|
||||
sessionPath := filepath.Join("..", "..", "examples", "session.minimal.yml")
|
||||
|
||||
cfg, err := Load(pipelinePath, sessionPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Load(examples) error = %v", err)
|
||||
}
|
||||
if err := Validate(cfg); err != nil {
|
||||
t.Fatalf("Validate(examples) error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func writeConfigFiles(t *testing.T, pipelineYAML, sessionYAML string) (string, string) {
|
||||
|
||||
Reference in New Issue
Block a user