Adopt Notarius configuration overlays
This commit is contained in:
@@ -238,7 +238,14 @@ func TestNotariusCredentialOverlayReplacementAndProvenance(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotariusConfigProfileComposition(t *testing.T) {
|
||||
func TestNotariusRetiredConfigProfileRejected(t *testing.T) {
|
||||
root := writePipelineFixture(t, t.TempDir(), "pipeline.yml", "whisperx:\n transcribe_url: https://transcription.example.test/transcribe\nnotarius:\n config_profile: testing\n")
|
||||
if _, err := LoadPipelineWithOptions(root, PipelineLoadOptions{}); err == nil {
|
||||
t.Fatal("retired Notarius config_profile field was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotariusConfigOverlayComposition(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
baseValue string
|
||||
@@ -250,15 +257,15 @@ func TestNotariusConfigProfileComposition(t *testing.T) {
|
||||
{name: "explicit empty", baseValue: `""`, want: stringPointer("")},
|
||||
{name: "explicit default", baseValue: "default", want: stringPointer("default")},
|
||||
{name: "base named selection", baseValue: "production", want: stringPointer("production")},
|
||||
{name: "profile replaces named selection", baseValue: "production", overlayName: "testing", overlay: "notarius:\n config_profile: inexpensive\n", want: stringPointer("inexpensive")},
|
||||
{name: "profile clears named selection", baseValue: "production", overlayName: "testing", overlay: "notarius:\n config_profile: null\n"},
|
||||
{name: "profile replaces named selection", baseValue: "production", overlayName: "testing", overlay: "notarius:\n config_overlay: inexpensive\n", want: stringPointer("inexpensive")},
|
||||
{name: "profile clears named selection", baseValue: "production", overlayName: "testing", overlay: "notarius:\n config_overlay: null\n"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
rootYAML := "whisperx:\n transcribe_url: https://transcription.example.test/transcribe\nnotarius:\n enabled: false\n"
|
||||
if test.baseValue != "" {
|
||||
rootYAML += " config_profile: " + test.baseValue + "\n"
|
||||
rootYAML += " config_overlay: " + test.baseValue + "\n"
|
||||
}
|
||||
root := writePipelineFixture(t, dir, "pipeline.yml", rootYAML)
|
||||
options := PipelineLoadOptions{}
|
||||
@@ -270,8 +277,8 @@ func TestNotariusConfigProfileComposition(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.Notarius == nil || !reflect.DeepEqual(cfg.Notarius.ConfigProfile, test.want) {
|
||||
t.Fatalf("config profile = %#v, want %#v", cfg.Notarius.ConfigProfile, test.want)
|
||||
if cfg.Notarius == nil || !reflect.DeepEqual(cfg.Notarius.ConfigOverlay, test.want) {
|
||||
t.Fatalf("config overlay = %#v, want %#v", cfg.Notarius.ConfigOverlay, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user