Use native configuration validation and diagnostics
This commit is contained in:
@@ -19,7 +19,7 @@ func TestContextlessDocumentsRejectImports(t *testing.T) {
|
||||
return err
|
||||
},
|
||||
} {
|
||||
if err := load(); err == nil || !strings.Contains(err.Error(), "import.disabled") {
|
||||
if err := load(); err == nil || !strings.Contains(configurationErrorText(err), "import.disabled") {
|
||||
t.Fatalf("load error = %v, want disabled-import diagnostic", err)
|
||||
}
|
||||
}
|
||||
@@ -27,10 +27,10 @@ func TestContextlessDocumentsRejectImports(t *testing.T) {
|
||||
|
||||
func TestInspectedDocumentsEnforceConfigKitSizeLimit(t *testing.T) {
|
||||
tooLarge := bytes.Repeat([]byte{' '}, int(maxConfigDocumentBytes)+1)
|
||||
if _, err := LoadSessionBytesWithOptions("session.yml", tooLarge, SessionLoadOptions{}); err == nil || !strings.Contains(err.Error(), "exceeds") {
|
||||
if _, err := LoadSessionBytesWithOptions("session.yml", tooLarge, SessionLoadOptions{}); err == nil || !strings.Contains(configurationErrorText(err), "exceeds") {
|
||||
t.Fatalf("oversized session error = %v", err)
|
||||
}
|
||||
if _, err := ParseParty(tooLarge); err == nil || !strings.Contains(err.Error(), "exceeds") {
|
||||
if _, err := ParseParty(tooLarge); err == nil || !strings.Contains(configurationErrorText(err), "exceeds") {
|
||||
t.Fatalf("oversized party error = %v", err)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestInspectedDocumentsEnforceConfigKitSizeLimit(t *testing.T) {
|
||||
if err := os.WriteFile(path, tooLarge, 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := LoadSession(path); err == nil || !strings.Contains(err.Error(), "limit") {
|
||||
if _, err := LoadSession(path); err == nil || !strings.Contains(configurationErrorText(err), "limit") {
|
||||
t.Fatalf("oversized local session error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user