@@ -252,7 +252,7 @@ func TestLocalStackWithIndividualServicesOnContext(t *testing.T) {
252252 dialer := & net.Dialer {Timeout : time .Second }
253253 for service := range localstack .AvailableServices {
254254 t .Run (service .Name , func (t * testing.T ) {
255- ctx , cancel := context .WithCancel (context . Background ())
255+ ctx , cancel := context .WithCancel (t . Context ())
256256 l , err := localstack .NewInstance ()
257257 require .NoError (t , err )
258258 require .NoError (t , l .StartWithContext (ctx , service ))
@@ -267,7 +267,11 @@ func TestLocalStackWithIndividualServicesOnContext(t *testing.T) {
267267
268268 // wait until service was shutdown
269269 require .Eventually (t , func () bool {
270- req := httptest .NewRequestWithContext (t .Context (), http .MethodGet , l .EndpointV2 (service ), nil )
270+ address := l .EndpointV2 (service )
271+ if address == "" {
272+ return true
273+ }
274+ req := httptest .NewRequestWithContext (t .Context (), http .MethodGet , address , nil )
271275 res , err := cl .Do (req )
272276 defer func () {
273277 if res == nil || res .Body == nil {
@@ -300,7 +304,11 @@ func TestLocalStackWithIndividualServices(t *testing.T) {
300304
301305 // wait until service was shutdown
302306 require .Eventually (t , func () bool {
303- req := httptest .NewRequestWithContext (t .Context (), http .MethodGet , l .EndpointV2 (service ), nil )
307+ address := l .EndpointV2 (service )
308+ if address == "" {
309+ return true
310+ }
311+ req := httptest .NewRequestWithContext (t .Context (), http .MethodGet , address , nil )
304312 res , err := cl .Do (req )
305313 defer func () {
306314 if res == nil || res .Body == nil {
0 commit comments