2026-09-07 04:13:58 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
|
|
import (
|
2026-11-23 14:23:53 +00:00
|
|
|
"context"
|
2026-09-07 04:13:58 +00:00
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
2026-11-23 14:23:53 +00:00
|
|
|
func TestNotariusCredentialLoadsFromConfiguredBootstrap(t *testing.T) {
|
|
|
|
|
const name = "NARRATIO_NOTARIUS_CONFIGURED_BOOTSTRAP"
|
2026-09-07 12:14:10 +00:00
|
|
|
restoreEnvAfterTest(t, name)
|
2026-11-23 14:23:53 +00:00
|
|
|
dir := t.TempDir()
|
|
|
|
|
mustWriteSecretFile(t, filepath.Join(dir, "secrets", name), "synthetic-value\n")
|
|
|
|
|
pipeline := filepath.Join(dir, "pipeline.yml")
|
|
|
|
|
mustWriteTestFile(t, pipeline, "config: {secrets_dir: secrets}\nwhisperx: {transcribe_url: https://example.test/transcribe}\nnotarius: {enabled: false, credentials: ["+name+"]}\n")
|
|
|
|
|
acquisition := newConfigurationAcquisition(configurationSelection{Config: suppliedSelection(pipeline)}, commandDependencies{})
|
|
|
|
|
loaded, err := acquisition.Pipeline(context.Background())
|
2026-09-07 12:14:10 +00:00
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
2026-11-23 14:23:53 +00:00
|
|
|
if len(loaded.Notarius.Credentials) != 1 || loaded.Notarius.Credentials[0].Value() != "synthetic-value" {
|
|
|
|
|
t.Fatal("credential was not resolved")
|
2026-09-07 12:14:10 +00:00
|
|
|
}
|
2026-11-23 14:23:53 +00:00
|
|
|
if os.Getenv(name) != "synthetic-value" || acquisition.bootstrapReport == nil {
|
|
|
|
|
t.Fatal("configured bootstrap did not retain its report")
|
2026-09-07 12:14:10 +00:00
|
|
|
}
|
|
|
|
|
}
|