Skip to content

Commit

Permalink
Handle test server connection timeouts
Browse files Browse the repository at this point in the history
Add logic to skip tests if there's a timeout error while connecting to the test server. This ensures that transient network issues do not cause test failures.
  • Loading branch information
wneessen committed Oct 26, 2024
1 parent 23399ed commit d7b3248
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 3 deletions.
5 changes: 5 additions & 0 deletions client_121_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"context"
"errors"
"fmt"
"net"
"os"
"reflect"
"strings"
Expand Down Expand Up @@ -95,6 +96,10 @@ func TestClient_DialWithContextNewVersionsOnly(t *testing.T) {
}

if err = client.DialWithContext(ctxDial); err != nil {
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
t.Skip("failed to connect to the test server due to timeout")
}
t.Fatalf("failed to connect to the test server: %s", err)
}
t.Cleanup(func() {
Expand Down
Loading

0 comments on commit d7b3248

Please sign in to comment.