Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix decode arrow check after update #416

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading