Exemplo n.º 1
0
func TestLargeRequest(t *testing.T) {
	arg := testutils.RandString(100000)
	res := strings.ToLower(arg)

	fmt.Println(len(arg))
	withSetup(t, func(ctx Context, args testArgs) {
		args.s2.On("Echo", ctxArg(), arg).Return(res, nil)

		got, err := args.c2.Echo(ctx, arg)
		if assert.NoError(t, err, "Echo got error") {
			assert.Equal(t, res, got, "Echo got unexpected response")
		}
	})
}
Exemplo n.º 2
0
func TestVarintString(t *testing.T) {
	tests := []string{
		"",
		"short string",
		testutils.RandString(1000),
	}

	for _, tt := range tests {
		buf := make([]byte, 2000)
		wb := typed.NewWriteBuffer(buf)
		writeVarintString(wb, tt)

		rb := typed.NewReadBuffer(buf)
		got := readVarintString(rb)
		assert.Equal(t, tt, got, "Varint string mismatch")
	}
}