@@ -46,14 +46,37 @@ func TestHTTPResolver(t *testing.T) {
4646 base := s .URL [7 :] // strip "http://"
4747 return base , options , s .Close
4848 }
49-
5049 runBasicTest (t , "testname" , s )
5150}
5251
5352func TestHTTPSResolver (t * testing.T ) {
5453 runBasicTest (t , "testname" , tlsServer )
5554}
5655
56+ func TestResolverOptionsRace (t * testing.T ) {
57+ header := http.Header {}
58+ header .Set ("X-Test" , "test" )
59+
60+ s := func (h http.Handler ) (string , ResolverOptions , func ()) {
61+ s := httptest .NewServer (h )
62+
63+ options := ResolverOptions {
64+ Headers : header ,
65+ }
66+ base := s .URL [7 :] // strip "http://"
67+ return base , options , s .Close
68+ }
69+
70+ for i := 0 ; i < 5 ; i ++ {
71+ t .Run (fmt .Sprintf ("test ResolverOptions race %d" , i ), func (t * testing.T ) {
72+ // parallel sub tests so the race condition (if not handled) can be caught
73+ // by race detector
74+ t .Parallel ()
75+ runBasicTest (t , "testname" , s )
76+ })
77+ }
78+ }
79+
5780func TestBasicResolver (t * testing.T ) {
5881 basicAuth := func (h http.Handler ) (string , ResolverOptions , func ()) {
5982 // Wrap with basic auth
0 commit comments