Document and validate configured secrets bootstrap

This commit is contained in:
2026-11-18 01:10:24 +00:00
parent ab6e610fb7
commit eeafc356e4
13 changed files with 172 additions and 46 deletions

View File

@@ -2,6 +2,7 @@ package engine
import (
"reflect"
"runtime"
"testing"
"go.maximumdirect.net/configkit/internal/document"
@@ -127,6 +128,19 @@ func TestBootstrapControlExtraction(t *testing.T) {
}
}
func TestBootstrapDirectoryRejectsWindowsRootedPaths(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("host path syntax differs")
}
for _, path := range []string{`C:relative`, `\rooted`} {
root := parseRootDirectiveDocument(t, "config: {secrets_dir: '"+path+"'}\n")
_, diagnostics := extractBootstrapSettings(root)
if len(diagnostics) != 1 || diagnostics[0].Code != CodeSecretsInvalidPath {
t.Fatalf("path %q: %#v", path, diagnostics)
}
}
}
func TestBootstrapControlsRequireMainSource(t *testing.T) {
root := parseRootDirectiveDocument(t, "config: {secrets_dir: secrets, secrets_overwrite: true}\nvalue: ordinary\n")
for _, context := range []rootDirectiveContext{rootDirectiveContextSource, rootDirectiveContextLayered} {