mirror of
https://github.com/coredns/coredns.git
synced 2026-06-01 23:00:23 -04:00
fix: use descriptive error for unknown block options in health and log plugins (#8128)
This commit is contained in:
committed by
GitHub
parent
afdf121a5a
commit
0bcb17df06
@@ -2,6 +2,7 @@ package log
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/coredns/caddy"
|
||||
@@ -182,3 +183,14 @@ func TestLogParse(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogParseUnknownProperty(t *testing.T) {
|
||||
c := caddy.NewTestController("dns", `log { unknown }`)
|
||||
_, err := logParse(c)
|
||||
if err == nil {
|
||||
t.Fatal("expected error for unknown block option, got nil")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "unknown property") {
|
||||
t.Errorf("expected error to contain 'unknown property', got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user