From f9eb9518e070833c7bcb94b8a84c37f7c8af7f15 Mon Sep 17 00:00:00 2001 From: Oleg Jukovec Date: Wed, 23 Oct 2024 21:48:39 +0300 Subject: [PATCH] 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. https://github.com/tarantool/tarantool/pull/10665 Part of #415 --- arrow/tarantool_test.go | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/arrow/tarantool_test.go b/arrow/tarantool_test.go index 2ff29fc8..c02ce4f0 100644 --- a/arrow/tarantool_test.go +++ b/arrow/tarantool_test.go @@ -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" @@ -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" + @@ -53,7 +59,7 @@ func TestInsert_invalid(t *testing.T) { "00000000000000000000000000000800000000000000000000000100000001000000" + "0000000000000000000000000a00140004000c0010000c0014000400060008000c00" + "00000000000000000000", - "memtx does not support arrow format", + []iproto.Error{iproto.ER_UNSUPPORTED}, }, } @@ -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 }) }