check return value from `unmarshalRoot` in test and fail if false

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Andrew Savinykh 2026-02-15 21:28:23 +13:00 committed by GitHub
parent 2fe6d306aa
commit f58eeef49d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -99,7 +99,10 @@ func TestEnvInConfig(t *testing.T) {
t.Errorf("Error loading YAML: %v", err) t.Errorf("Error loading YAML: %v", err)
continue continue
} }
unmarshalRoot(k, cfg) if !unmarshalRoot(k, cfg) {
t.Errorf("Error unmarshalling config for env=%q", tt.input)
continue
}
field := tt.selector(cfg) field := tt.selector(cfg)
assert.Equal(t, tt.output, field, assert.Equal(t, tt.output, field,
"Unmarshaled config field doesn't match expected value: env=%q", tt.input) "Unmarshaled config field doesn't match expected value: env=%q", tt.input)