Skip to content

Commit f9eb951

Browse files
committed
tests: fix decode arrow check after update
The pull request changes [1] changes an error message on arrow decoding. The patch replaces a check of error message to a check of error code as it is a more stable check. However, the code is changed too. So as a temporary solution we need to work with both codes at the same time. 1. tarantool/tarantool#10665 Part of #415
1 parent 8cf8673 commit f9eb951

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

arrow/tarantool_test.go

+21-10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"time"
1010

1111
"github.com/stretchr/testify/require"
12+
"github.com/tarantool/go-iproto"
13+
1214
"github.com/tarantool/go-tarantool/v2"
1315
"github.com/tarantool/go-tarantool/v2/arrow"
1416
"github.com/tarantool/go-tarantool/v2/test_helpers"
@@ -33,15 +35,19 @@ var opts = tarantool.Opts{
3335
func TestInsert_invalid(t *testing.T) {
3436
arrows := []struct {
3537
arrow string
36-
expected string
38+
expected []iproto.Error
3739
}{
3840
{
3941
"",
40-
"Failed to decode Arrow IPC data",
42+
// TODO: delete iproto.ER_ARROW_IPC_DECODE, see:
43+
// https://github.com/tarantool/go-tarantool/issues/415
44+
[]iproto.Error{iproto.ER_INVALID_MSGPACK, iproto.ER_ARROW_IPC_DECODE},
4145
},
4246
{
4347
"00",
44-
"Failed to decode Arrow IPC data",
48+
// TODO: delete iproto.ER_ARROW_IPC_DECODE, see:
49+
// https://github.com/tarantool/go-tarantool/issues/415
50+
[]iproto.Error{iproto.ER_INVALID_MSGPACK, iproto.ER_ARROW_IPC_DECODE},
4551
},
4652
{
4753
"ffffffff70000000040000009effffff0400010004000000" +
@@ -53,7 +59,7 @@ func TestInsert_invalid(t *testing.T) {
5359
"00000000000000000000000000000800000000000000000000000100000001000000" +
5460
"0000000000000000000000000a00140004000c0010000c0014000400060008000c00" +
5561
"00000000000000000000",
56-
"memtx does not support arrow format",
62+
[]iproto.Error{iproto.ER_UNSUPPORTED},
5763
},
5864
}
5965

@@ -66,14 +72,19 @@ func TestInsert_invalid(t *testing.T) {
6672
require.NoError(t, err)
6773

6874
arr, err := arrow.MakeArrow(data)
69-
if err != nil {
70-
require.ErrorContains(t, err, a.expected)
71-
return
72-
}
73-
req := arrow.NewInsertRequest(space, arr)
75+
require.NoError(t, err)
7476

77+
req := arrow.NewInsertRequest(space, arr)
7578
_, err = conn.Do(req).Get()
76-
require.ErrorContains(t, err, a.expected)
79+
ttErr := err.(tarantool.Error)
80+
81+
require.Contains(t, a.expected, ttErr.Code)
82+
// TODO: replace the check with:
83+
//
84+
// require.Equal(t, a.expected, ttErr.Code)
85+
//
86+
// See:
87+
// https://github.com/tarantool/go-tarantool/issues/415
7788
})
7889
}
7990

0 commit comments

Comments
 (0)