Skip to content

Commit

Permalink
test: add race test
Browse files Browse the repository at this point in the history
  • Loading branch information
ppzqh committed Sep 4, 2024
1 parent 6e8bc1c commit 56f0f7a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/remote/trans/nphttp2/grpc/http2_client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package grpc

import (
"context"
"github.com/cloudwego/kitex/internal/test"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/codes"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/metadata"
"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/status"
"golang.org/x/net/http2"
"math"
"testing"
)

func TestHttp2ClientTrailerRace(t *testing.T) {
_, ct := setUp(t, 0, math.MaxUint32, normal)
s, err := ct.NewStream(context.Background(), &CallHdr{})
test.Assert(t, err == nil, err)

go func() {
s.Trailer()
}()
go func() {
mdata := metadata.Pairs("k", "v")
ct.closeStream(s, nil, false, http2.ErrCodeNo, status.New(codes.OK, ""), mdata, true)
}()
}

0 comments on commit 56f0f7a

Please sign in to comment.