mirror of
https://github.com/adnanh/webhook.git
synced 2025-10-05 06:01:03 +00:00
Fix error on unrecognized configuration keys
- Error while loading configuration with unrecognized keys - Do not start if failed to load configuration from file
This commit is contained in:
parent
dab29e7267
commit
d7367bcb8b
4 changed files with 49 additions and 13 deletions
|
@ -424,6 +424,7 @@ var hooksLoadFromFileTests = []struct {
|
|||
{"", false, true},
|
||||
// failures
|
||||
{"missing.json", false, false},
|
||||
{"testdata/unrecognized.yaml", false, false},
|
||||
}
|
||||
|
||||
func TestHooksLoadFromFile(t *testing.T) {
|
||||
|
@ -433,6 +434,7 @@ func TestHooksLoadFromFile(t *testing.T) {
|
|||
for _, tt := range hooksLoadFromFileTests {
|
||||
h := &Hooks{}
|
||||
err := h.LoadFromFile(tt.path, tt.asTemplate)
|
||||
t.Log(err)
|
||||
if (err == nil) != tt.ok {
|
||||
t.Errorf(err.Error())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue