Expose native configuration inspection scopes
This commit is contained in:
@@ -70,7 +70,7 @@ whisperx:
|
||||
|
||||
func TestPipelineOverlayDoesNotDiscoverLegacyDirectory(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
writePipelineFixture(t, dir, "pipeline.yml", "config:\n imports:\n - path: profiles/shared.yml\n")
|
||||
writePipelineFixture(t, dir, "pipeline.yml", testTranscriptionConfig+"config:\n imports:\n - path: profiles/shared.yml\n")
|
||||
writePipelineFixture(t, dir, "profiles/shared.yml", "workspace:\n root: /srv/base\n")
|
||||
writePipelineFixture(t, dir, "profiles/testing.yml", "workspace:\n root: /srv/old\n")
|
||||
if base, err := LoadPipeline(filepath.Join(dir, "pipeline.yml")); err != nil || base.Workspace.Root != "/srv/base" {
|
||||
@@ -280,7 +280,7 @@ whisperx:
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipelineInheritanceRetainsZeroTimeoutForDomainValidation(t *testing.T) {
|
||||
func TestPipelineInheritanceValidatesZeroTimeoutDuringLoading(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
writePipelineFixture(t, dir, "pipeline.yml", `config:
|
||||
imports:
|
||||
@@ -298,19 +298,11 @@ whisperx:
|
||||
output_path: artifacts/child.md
|
||||
`)
|
||||
|
||||
cfg, err := LoadPipeline(filepath.Join(dir, "pipeline.yml"))
|
||||
if err != nil {
|
||||
t.Fatalf("LoadPipeline() error = %v", err)
|
||||
}
|
||||
if got := cfg.Scriptorium.Artifacts["child"].Timeout; got != "0s" {
|
||||
t.Fatalf("inherited zero timeout = %q, want 0s", got)
|
||||
}
|
||||
if !cfg.ConfigKitResult().Metadata().IsExplicit(configkit.Keys("scriptorium", "artifacts", "child", "timeout")) {
|
||||
t.Fatal("inherited zero timeout is not marked explicit")
|
||||
}
|
||||
if err := ValidatePipelineConfig(cfg); err == nil || !strings.Contains(err.Error(), "timeout must be positive") {
|
||||
t.Fatalf("ValidatePipelineConfig() error = %v, want invalid zero timeout", err)
|
||||
_, err := LoadPipeline(filepath.Join(dir, "pipeline.yml"))
|
||||
if err == nil || !strings.Contains(err.Error(), "timeout must be positive") {
|
||||
t.Fatalf("LoadPipeline() error = %v, want invalid zero timeout", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestPipelineExplicitEmptyTimeoutDoesNotReceiveDefault(t *testing.T) {
|
||||
@@ -531,19 +523,7 @@ func TestNotariusCredentialOverlayReplacementAndProvenance(t *testing.T) {
|
||||
if len(cfg.Notarius.Credentials) != 1 || cfg.Notarius.Credentials[0].EnvName() != profileKey || !cfg.Notarius.Credentials[0].IsResolved() {
|
||||
t.Fatal("overlay credential was not resolved")
|
||||
}
|
||||
sources, err := EffectivePipelineSources(cfg, ResolvedParty{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
found := false
|
||||
for _, source := range sources {
|
||||
if source.Path == "notarius.credentials" {
|
||||
found = source.Source == overlay
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatal("Notarius credential provenance did not identify the selected overlay")
|
||||
}
|
||||
assertNativePipelineSource(t, cfg, configkit.Keys("notarius", "credentials"), overlay)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -603,16 +583,7 @@ func TestNotariusCredentialRootProvenance(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sources, err := EffectivePipelineSources(cfg, ResolvedParty{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, source := range sources {
|
||||
if source.Path == "notarius.credentials" && source.Source == root {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatal("Notarius credential provenance did not identify the root pipeline")
|
||||
assertNativePipelineSource(t, cfg, configkit.Keys("notarius", "credentials"), root)
|
||||
}
|
||||
|
||||
func TestNotariusCacheControlProfileReplacementAndNullReset(t *testing.T) {
|
||||
@@ -649,19 +620,8 @@ func TestNotariusCacheControlProfileReplacementAndNullReset(t *testing.T) {
|
||||
if !test.wantSource {
|
||||
return
|
||||
}
|
||||
sources, err := EffectivePipelineSources(cfg, ResolvedParty{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
found := map[string]bool{}
|
||||
for _, source := range sources {
|
||||
if source.Path == "notarius.resume" || source.Path == "notarius.chunk_cache" {
|
||||
found[source.Path] = source.Source == overlay
|
||||
}
|
||||
}
|
||||
if !found["notarius.resume"] || !found["notarius.chunk_cache"] {
|
||||
t.Fatalf("cache-control provenance did not identify profile: %#v", found)
|
||||
}
|
||||
assertNativePipelineSource(t, cfg, configkit.Keys("notarius", "resume"), overlay)
|
||||
assertNativePipelineSource(t, cfg, configkit.Keys("notarius", "chunk_cache"), overlay)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -708,3 +668,21 @@ func writePipelineFixture(t *testing.T, root, relative, contents string) string
|
||||
}
|
||||
|
||||
func stringPointer(value string) *string { return &value }
|
||||
|
||||
const testTranscriptionConfig = "whisperx:\n transcribe_url: https://transcription.example.test/transcribe\n"
|
||||
|
||||
func assertNativePipelineSource(t *testing.T, cfg *PipelineConfig, path configkit.Path, expected string) {
|
||||
t.Helper()
|
||||
result := cfg.ConfigKitResult()
|
||||
info, ok := result.Metadata().Lookup(path)
|
||||
if !ok {
|
||||
t.Fatalf("native path %s is absent", path.String())
|
||||
}
|
||||
for _, location := range info.Origin.Locations {
|
||||
source, ok := result.Source(location.SourceID)
|
||||
if ok && source.Path == expected {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatalf("native path %s has no origin in %s: %#v", path.String(), expected, info.Origin)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user