From 7faaba8864102259a3b273a41535617c77c552ef Mon Sep 17 00:00:00 2001 From: Allen Xu Date: Sat, 3 Dec 2022 12:59:23 +0800 Subject: [PATCH] Update Unit Test --- .github/workflows/go.yml | 16 ++++++++-------- server_test.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4c2e7c6..04c616d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,15 +5,15 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - name: Set up Go 1.16 - uses: actions/setup-go@v1 + - name: Set up Go 1.18 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: 1.18 id: go - name: Go version run: go version - name: Code - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Intsall Golangci-lint run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b . latest - name: Lint @@ -27,15 +27,15 @@ jobs: matrix: os: [macOS-latest,ubuntu-latest,windows-latest] steps: - - name: Set up Go 1.16 - uses: actions/setup-go@v1 + - name: Set up Go 1.18 + uses: actions/setup-go@v3 with: - go-version: 1.16 + go-version: 1.18 id: go - name: Go version run: go version - name: Code - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Go Get dependencies run: go get -v -t -d ./... - name: Go Test diff --git a/server_test.go b/server_test.go index 494d0ee..754967d 100644 --- a/server_test.go +++ b/server_test.go @@ -170,7 +170,7 @@ func TestServer_Stop(t *testing.T) { wg := &sync.WaitGroupWrapper{} for i := 0; i < 100; i++ { wg.AddAndRun(func() { - conn, err := net.DialTimeout("tcp", "127.0.0.1:1832", time.Second*60) + conn, err := net.DialTimeout("tcp", "127.0.0.1:1832", time.Second*1) if err != nil { failed.Add(1) log.Error(err) @@ -186,7 +186,7 @@ func TestServer_Stop(t *testing.T) { wg.Wait() log.Infof("Success: %d Failed: %d\n", success, failed) - time.Sleep(time.Second) + time.Sleep(time.Second * 2) count := handler.Count.Get() if count != 0 { t.Fatal(count)