Use native configuration validation and diagnostics
This commit is contained in:
@@ -57,7 +57,7 @@ func TestSessionDiscoveryDistinguishesAbsenceFromInvalidSelection(t *testing.T)
|
||||
if cfg, path, err := DiscoverSession([]string{first, second}, SessionLoadOptions{}); err != nil || cfg == nil || path != second {
|
||||
t.Fatalf("selected = %#v %q %v", cfg, path, err)
|
||||
}
|
||||
if _, _, err := DiscoverSession([]string{first, second}, SessionLoadOptions{SessionID: "different"}); err == nil || !strings.Contains(err.Error(), "mismatch") {
|
||||
if _, _, err := DiscoverSession([]string{first, second}, SessionLoadOptions{SessionID: "different"}); err == nil || !strings.Contains(configurationErrorText(err), "mismatch") {
|
||||
t.Fatalf("identity error = %v", err)
|
||||
}
|
||||
if err := os.WriteFile(first, []byte("inputs: [invalid\n"), 0o644); err != nil {
|
||||
@@ -75,7 +75,7 @@ func TestImportedSessionPlaceholderIsRejected(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
root := writePipelineFixture(t, dir, "session.yml", "config:\n imports:\n - path: fragment.yml\nsession_id: test\n")
|
||||
writePipelineFixture(t, dir, "fragment.yml", "title: '{{ title }}'\n")
|
||||
if _, err := LoadSession(root); err == nil || !strings.Contains(err.Error(), "title") || !strings.Contains(err.Error(), "session init") {
|
||||
if _, err := LoadSession(root); err == nil || !strings.Contains(configurationErrorText(err), "title") || !strings.Contains(configurationErrorText(err), "session init") {
|
||||
t.Fatalf("placeholder error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user