Files
narratio/internal/app/secrets_bootstrap_test.go

29 lines
1.1 KiB
Go

package app
import (
"context"
"os"
"path/filepath"
"testing"
)
func TestNotariusCredentialLoadsFromConfiguredBootstrap(t *testing.T) {
const name = "NARRATIO_NOTARIUS_CONFIGURED_BOOTSTRAP"
restoreEnvAfterTest(t, name)
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())
if err != nil {
t.Fatal(err)
}
if len(loaded.Notarius.Credentials) != 1 || loaded.Notarius.Credentials[0].Value() != "synthetic-value" {
t.Fatal("credential was not resolved")
}
if os.Getenv(name) != "synthetic-value" || acquisition.bootstrapReport == nil {
t.Fatal("configured bootstrap did not retain its report")
}
}