From e4ff698af911796ddc8ea970766b4f68ac40b07f Mon Sep 17 00:00:00 2001
From: Arseniy Volynets <vol0ncar@yandex.ru>
Date: Tue, 14 Feb 2023 13:00:52 +0300
Subject: [PATCH] fix: flaky test: sort rows before comparing

---
 .../test_app/test/integration/groupby_test.lua       |  7 +++----
 .../test_app/test/integration/motion_test.lua        | 12 ++++++------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/sbroad-cartridge/test_app/test/integration/groupby_test.lua b/sbroad-cartridge/test_app/test/integration/groupby_test.lua
index 5ef8f64d20..f5ec1f34aa 100644
--- a/sbroad-cartridge/test_app/test/integration/groupby_test.lua
+++ b/sbroad-cartridge/test_app/test/integration/groupby_test.lua
@@ -1,6 +1,5 @@
 local t = require('luatest')
 local groupby_queries = t.group('groupby_queries')
-
 local helper = require('test.helper.cluster_no_replication')
 local cluster = nil
 
@@ -328,7 +327,7 @@ groupby_queries.test_with_selection = function ()
     })
 end
 
-groupby_queries.test_with_JOIN = function ()
+groupby_queries.test_with_join = function ()
     local api = cluster:server("api-1").net_box
 
     local r, err = api:call("sbroad.execute", { [[
@@ -442,7 +441,7 @@ groupby_queries.test_with_join3 = function ()
 end
 
 
-groupby_queries.test_with_UNION = function ()
+groupby_queries.test_with_union = function ()
     local api = cluster:server("api-1").net_box
     local r, err = api:call("sbroad.execute", {
         [[SELECT "a" FROM "arithmetic_space" GROUP BY "a" UNION ALL SELECT "a" FROM "arithmetic_space2"]], {}
@@ -499,7 +498,7 @@ groupby_queries.test_with_UNION = function ()
     })
 end
 
-groupby_queries.test_with_EXCEPT = function ()
+groupby_queries.test_with_except = function ()
     local api = cluster:server("api-1").net_box
     local r, err = api:call("sbroad.execute", {
         [[
diff --git a/sbroad-cartridge/test_app/test/integration/motion_test.lua b/sbroad-cartridge/test_app/test/integration/motion_test.lua
index 85816ed07a..8063e5d3fb 100644
--- a/sbroad-cartridge/test_app/test/integration/motion_test.lua
+++ b/sbroad-cartridge/test_app/test/integration/motion_test.lua
@@ -246,14 +246,14 @@ g.test_join_segment_motion = function()
     ]], {} })
 
     t.assert_equals(err, nil)
-    t.assert_equals(r, {
-        metadata = {
+    t.assert_equals(r.metadata, {
             {name = "t1.id", type = "integer"},
-        },
-        rows = {
+        })
+    t.assert_items_equals(r.rows,
+        {
             { 1 },
             { 3 },
             { 2 },
-        },
-    })
+        }
+    )
 end
-- 
GitLab