Skip to content

Commit

Permalink
tests: improve test reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Oct 18, 2024
1 parent 4104ee3 commit 20d8d46
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/snclient/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package snclient
import (
"context"
"fmt"
"net"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -440,8 +439,8 @@ allowed hosts += 192.168.3.3`

// wait up to 30 seconds for mock server to start
for range 300 {
_, err := net.DialTimeout("tcp", fmt.Sprintf("127.0.0.1:%d", testPort), DefaultSocketTimeout*time.Second)
if err == nil {
res, err := snc.httpClient(&HTTPClientOptions{reqTimeout: DefaultSocketTimeout}).Get(fmt.Sprintf("http://localhost:%d", testPort))

Check failure on line 442 in pkg/snclient/config_test.go

View workflow job for this annotation

GitHub Actions / test

response body must be closed (bodyclose)
if err == nil && res.StatusCode == http.StatusOK {
break
}
time.Sleep(100 * time.Millisecond)
Expand Down

0 comments on commit 20d8d46

Please sign in to comment.