postgres: return an empty list of addresses on dns errors (#3637)

This commit is contained in:
Caleb Doxsey 2022-09-30 12:00:40 -06:00 committed by GitHub
parent 3fec00f2a8
commit 3b2cc6720a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)
}