forked from p93542168/wheat-cache
test(gateway): add gateway test
This commit is contained in:
parent
ebdc5bd5b0
commit
91d93bf5be
|
@ -0,0 +1,34 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gitee.com/timedb/wheatCache/pkg/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func TestContextChannel(t *testing.T) {
|
||||
cxt := context.Background()
|
||||
_, ctxChannel := context.WithCancel(cxt)
|
||||
ctxChannel()
|
||||
ctxChannel()
|
||||
}
|
||||
|
||||
func TestGateway_Master(t *testing.T) {
|
||||
comm, err := grpc.Dial("127.0.0.1:5891", grpc.WithInsecure())
|
||||
require.NoError(t, err)
|
||||
ctx := context.Background()
|
||||
cli := proto.NewCommServerClient(comm)
|
||||
resp, err := cli.Set(ctx, &proto.SetRequest{
|
||||
Key: &proto.BaseKey{
|
||||
Key: "aa",
|
||||
},
|
||||
Val: "awd",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
fmt.Printf(resp.Result)
|
||||
|
||||
}
|
Loading…
Reference in New Issue