From b50fcb1f816435141dad1beda45837454ecbb1a0 Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Mon, 15 Nov 2021 10:38:52 +0300 Subject: [PATCH 1/2] Make test case consistent with comments Original test case had failed with Tarantool 2.8.1 or newer due to error message rework [1]. Based on code comments and @funny-falcon response in #105, the test has been planned to be success insert test and not a duplicate key error test. This patch changes test case and asserts to its original idea. Since duplicate key test already exists in tarantool_test.go file [2], coverage should not decrease. 1. https://github.com/tarantool/tarantool/commit/d11fb3061e15faf4e0eb5375fb8056b4e64348ae 2. https://github.com/tarantool/go-tarantool/blob/61f3a41907b6bcb060e9fa07069cde5b33ba9764/tarantool_test.go#L437-L443 Closes #105 --- example_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/example_test.go b/example_test.go index f5f6f8f90..7b81bc28e 100644 --- a/example_test.go +++ b/example_test.go @@ -119,7 +119,7 @@ func Example() { fmt.Println("Insert Data", resp.Data) // insert new tuple { 11, 1 } - resp, err = client.Insert("test", &Tuple{Id: 10, Msg: "test", Name: "one"}) + resp, err = client.Insert("test", &Tuple{Id: 11, Msg: "test", Name: "one"}) fmt.Println("Insert Error", err) fmt.Println("Insert Code", resp.Code) fmt.Println("Insert Data", resp.Data) @@ -194,9 +194,9 @@ func Example() { // Insert Error // Insert Code 0 // Insert Data [[10 test one]] - // Insert Error Duplicate key exists in unique index 'primary' in space 'test' (0x3) - // Insert Code 3 - // Insert Data [] + // Insert Error + // Insert Code 0 + // Insert Data [[11 test one]] // Delete Error // Delete Code 0 // Delete Data [[10 test one]] From c806e1c98786e74caa09e9588f4e9081adf526c7 Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Mon, 15 Nov 2021 10:44:19 +0300 Subject: [PATCH 2/2] Fix ErrTupleFound assert fail message --- tarantool_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tarantool_test.go b/tarantool_test.go index 7c0552138..ae725fdc7 100644 --- a/tarantool_test.go +++ b/tarantool_test.go @@ -439,7 +439,7 @@ func TestClient(t *testing.T) { t.Errorf("Expected ErrTupleFound but got: %v", err) } if len(resp.Data) != 0 { - t.Errorf("Response Body len != 1") + t.Errorf("Response Body len != 0") } // Delete