Skip to content

Commit

Permalink
test(client): increase timeout for windows
Browse files Browse the repository at this point in the history
also:

* only test stable go version on windows
  • Loading branch information
xiaost committed Jan 23, 2025
1 parent 02acf0e commit 5310079
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
run: go test -race ./...

ut-windows:
strategy:
matrix:
version: ["1.20", "1.21", "1.22", "1.23"]
runs-on: windows-latest
env: # Fixes https://github.com/actions/setup-go/issues/240
GOMODCACHE: 'D:\go\pkg\mod'
Expand All @@ -49,13 +46,13 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
go-version: stable

- name: Unit Test
run: go test -race ./...

code-cov:
runs-on: [self-hosted, X64]
runs-on: [self-hosted, Linux, X64]
steps:
- uses: actions/checkout@v4
- name: Set up Go
Expand All @@ -71,7 +68,7 @@ jobs:
run: bash <(curl -s https://codecov.io/bash)

hz-test-unix:
runs-on: [ self-hosted, X64 ]
runs-on: [ self-hosted, Linux, X64 ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
Expand Down
8 changes: 7 additions & 1 deletion pkg/app/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import (
"path/filepath"
"reflect"
"regexp"
"runtime"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -457,7 +458,12 @@ func TestClientReadTimeout(t *testing.T) {
engine := route.NewEngine(opt)

readtimeout := 50 * time.Millisecond
sleeptime := 75 * time.Millisecond // must > readtimeout
if runtime.GOOS == "windows" {
// XXX: The windows CI instance powered by Github is quite unstable.
// Increase readtimeout here for better testing stability.
readtimeout = 2 * readtimeout
}
sleeptime := readtimeout + readtimeout/2 // must > readtimeout

engine.GET("/normal", func(c context.Context, ctx *app.RequestContext) {
ctx.String(201, "ok")
Expand Down

0 comments on commit 5310079

Please sign in to comment.