Document and validate configured secrets bootstrap
This commit is contained in:
@@ -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} {
|
||||
|
||||
Reference in New Issue
Block a user