postgres: return an empty list of addresses on dns errors

This commit is contained in:
Caleb Doxsey 2022-09-29 15:03:36 -06:00
parent 3fec00f2a8
commit c4e5e34bdc
2 changed files with 36 additions and 1 deletions

View file

@ -184,3 +184,17 @@ func TestBackend(t *testing.T) {
return nil
}))
}
func TestLookup(t *testing.T) {
t.Parallel()
ctx, clearTimeout := context.WithTimeout(context.Background(), time.Second*10)
t.Cleanup(clearTimeout)
cfg, err := ParseConfig("host=localhost")
assert.NoError(t, err)
addrs, err := cfg.ConnConfig.LookupFunc(ctx, "test.unknown")
assert.NoError(t, err)
assert.Empty(t, addrs)
}