Skip to content

Commit

Permalink
feat: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Duslia committed Jul 28, 2024
1 parent 1c2f0d3 commit 7d7a523
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/bytedance/go-tagexpr/v2 v2.9.2
github.com/bytedance/gopkg v0.0.0-20240507064146-197ded923ae3
github.com/bytedance/mockey v1.2.1
github.com/bytedance/mockey v1.2.10
github.com/bytedance/sonic v1.11.9
github.com/cloudwego/netpoll v0.6.2
github.com/fsnotify/fsnotify v1.5.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/bytedance/go-tagexpr/v2 v2.9.2 h1:QySJaAIQgOEDQBLS3x9BxOWrnhqu5sQ+f6H
github.com/bytedance/go-tagexpr/v2 v2.9.2/go.mod h1:5qsx05dYOiUXOUgnQ7w3Oz8BYs2qtM/bJokdLb79wRM=
github.com/bytedance/gopkg v0.0.0-20240507064146-197ded923ae3 h1:ZKUHguI38SRQJkq7hhmwn8lAv3xM6B5qkj1IneS15YY=
github.com/bytedance/gopkg v0.0.0-20240507064146-197ded923ae3/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ=
github.com/bytedance/mockey v1.2.1 h1:g84ngI88hz1DR4wZTL3yOuqlEcq67MretBfQUdXwrmw=
github.com/bytedance/mockey v1.2.1/go.mod h1:+Jm/fzWZAuhEDrPXVjDf/jLM2BlLXJkwk94zf2JZ3X4=
github.com/bytedance/mockey v1.2.10 h1:4JlMpkm7HMXmTUtItid+iCu2tm61wvq+ca1X2u7ymzE=
github.com/bytedance/mockey v1.2.10/go.mod h1:bNrUnI1u7+pAc0TYDgPATM+wF2yzHxmNH+iDXg4AOCU=
github.com/bytedance/sonic v1.11.9 h1:LFHENlIY/SLzDWverzdOvgMztTxcfcF+cqNsz9pK5zg=
github.com/bytedance/sonic v1.11.9/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
Expand Down
2 changes: 0 additions & 2 deletions pkg/app/client/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package client

import (
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -60,5 +59,4 @@ func TestClientOptions(t *testing.T) {
assert.DeepEqual(t, 5*time.Second, opt.RetryConfig.MaxDelay)
assert.DeepEqual(t, 1*time.Second, opt.RetryConfig.MaxJitter)
assert.DeepEqual(t, 1*time.Second, opt.ObservationInterval)
assert.DeepEqual(t, fmt.Sprint(retry.CombineDelay(retry.FixedDelayPolicy, retry.BackOffDelayPolicy, retry.RandomDelayPolicy)), fmt.Sprint(opt.RetryConfig.DelayPolicy))
}
10 changes: 5 additions & 5 deletions pkg/app/server/hertz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,28 +218,28 @@ func Test_getServerName(t *testing.T) {
}

func TestServer_Run(t *testing.T) {
hertz := New(WithHostPorts("127.0.0.1:8888"))
hertz := New(WithHostPorts("127.0.0.1:8899"))
hertz.GET("/test", func(c context.Context, ctx *app.RequestContext) {
path := ctx.Request.URI().PathOriginal()
ctx.SetBodyString(string(path))
})
hertz.POST("/redirect", func(c context.Context, ctx *app.RequestContext) {
ctx.Redirect(consts.StatusMovedPermanently, []byte("http://127.0.0.1:8888/test"))
ctx.Redirect(consts.StatusMovedPermanently, []byte("http://127.0.0.1:8899/test"))
})
go hertz.Run()
time.Sleep(100 * time.Microsecond)
resp, err := http.Get("http://127.0.0.1:8888/test")
resp, err := http.Get("http://127.0.0.1:8899/test")
assert.Nil(t, err)
assert.DeepEqual(t, consts.StatusOK, resp.StatusCode)
b := make([]byte, 5)
resp.Body.Read(b)
assert.DeepEqual(t, "/test", string(b))

resp, err = http.Get("http://127.0.0.1:8888/foo")
resp, err = http.Get("http://127.0.0.1:8899/foo")
assert.Nil(t, err)
assert.DeepEqual(t, consts.StatusNotFound, resp.StatusCode)

resp, err = http.Post("http://127.0.0.1:8888/redirect", "", nil)
resp, err = http.Post("http://127.0.0.1:8899/redirect", "", nil)
assert.Nil(t, err)
assert.DeepEqual(t, consts.StatusOK, resp.StatusCode)
b = make([]byte, 5)
Expand Down

0 comments on commit 7d7a523

Please sign in to comment.