test(client): add storage client

This commit is contained in:
bandl 2021-10-28 11:59:46 +08:00
parent dce8739514
commit 200623bd29
1 changed files with 18 additions and 1 deletions

View File

@ -13,8 +13,10 @@ func TestClient(t *testing.T) {
cli, err := NewWheatClient("127.0.0.1:5891", middle.WithUnaryColonyClient)
require.NoError(t, err)
ctx := context.Background()
bKey := &proto.BaseKey{
Key: "apple",
Ttl: 10,
}
resp, err := cli.Set(ctx, &proto.SetRequest{
Key: bKey,
@ -29,5 +31,20 @@ func TestClient(t *testing.T) {
})
require.NoError(t, err)
require.Equal(t, getResp.Result, "yyyy")
}
func TestClientGet(t *testing.T) {
cli, err := NewWheatClient("127.0.0.1:5891", middle.WithUnaryColonyClient)
require.NoError(t, err)
ctx := context.Background()
bKey := &proto.BaseKey{
Key: "apple",
}
getResp, err := cli.Get(ctx, &proto.GetRequest{
Key: bKey,
})
require.NoError(t, err)
require.Equal(t, getResp.Result, "yyyy")
}