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

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

Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com>
This commit is contained in:
backport-actions-token[bot] 2022-09-30 12:28:33 -06:00 committed by GitHub
parent c0a8870717
commit 88abdf8d4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 1 deletions

View file

@ -166,3 +166,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)
}