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:
Barak Amar 2022-10-11 10:04:37 +03:00
parent dab29e7267
commit d7367bcb8b
4 changed files with 49 additions and 13 deletions

View file

@ -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())
}