Skip to content

Commit

Permalink
tests: fix decode arrow check after update
Browse files Browse the repository at this point in the history
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
  • Loading branch information
oleg-jukovec committed Oct 24, 2024
1 parent 8cf8673 commit f9eb951
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions arrow/tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/tarantool/go-iproto"

"github.com/tarantool/go-tarantool/v2"
"github.com/tarantool/go-tarantool/v2/arrow"
"github.com/tarantool/go-tarantool/v2/test_helpers"
Expand All @@ -33,15 +35,19 @@ var opts = tarantool.Opts{
func TestInsert_invalid(t *testing.T) {
arrows := []struct {
arrow string
expected string
expected []iproto.Error
}{
{
"",
"Failed to decode Arrow IPC data",
// TODO: delete iproto.ER_ARROW_IPC_DECODE, see:
// https://github.com/tarantool/go-tarantool/issues/415
[]iproto.Error{iproto.ER_INVALID_MSGPACK, iproto.ER_ARROW_IPC_DECODE},
},
{
"00",
"Failed to decode Arrow IPC data",
// TODO: delete iproto.ER_ARROW_IPC_DECODE, see:
// https://github.com/tarantool/go-tarantool/issues/415
[]iproto.Error{iproto.ER_INVALID_MSGPACK, iproto.ER_ARROW_IPC_DECODE},
},
{
"ffffffff70000000040000009effffff0400010004000000" +
Expand All @@ -53,7 +59,7 @@ func TestInsert_invalid(t *testing.T) {
"00000000000000000000000000000800000000000000000000000100000001000000" +
"0000000000000000000000000a00140004000c0010000c0014000400060008000c00" +
"00000000000000000000",
"memtx does not support arrow format",
[]iproto.Error{iproto.ER_UNSUPPORTED},
},
}

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

arr, err := arrow.MakeArrow(data)
if err != nil {
require.ErrorContains(t, err, a.expected)
return
}
req := arrow.NewInsertRequest(space, arr)
require.NoError(t, err)

req := arrow.NewInsertRequest(space, arr)
_, err = conn.Do(req).Get()
require.ErrorContains(t, err, a.expected)
ttErr := err.(tarantool.Error)

require.Contains(t, a.expected, ttErr.Code)
// TODO: replace the check with:
//
// require.Equal(t, a.expected, ttErr.Code)
//
// See:
// https://github.com/tarantool/go-tarantool/issues/415
})
}

Expand Down

0 comments on commit f9eb951

Please sign in to comment.