*: limit request size for v3

This commit is contained in:
Xiang Li
2016-02-08 12:44:25 -08:00
parent b72a0788ad
commit 35567221a7
6 changed files with 45 additions and 0 deletions

View File

@ -413,6 +413,24 @@ func TestV3TxnInvaildRange(t *testing.T) {
}
}
func TestV3TooLargeRequest(t *testing.T) {
defer testutil.AfterTest(t)
clus := NewClusterV3(t, &ClusterConfig{Size: 3})
defer clus.Terminate(t)
kvc := clus.RandClient().KV
// 2MB request value
largeV := make([]byte, 2*1024*1024)
preq := &pb.PutRequest{Key: []byte("foo"), Value: largeV}
_, err := kvc.Put(context.Background(), preq)
if err != v3rpc.ErrRequestTooLarge {
t.Errorf("err = %v, want %v", err, v3rpc.ErrRequestTooLarge)
}
}
// TestV3Hash tests hash.
func TestV3Hash(t *testing.T) {
defer testutil.AfterTest(t)