From 371d4110fccef6433b0fdd7ae060d647a994007f Mon Sep 17 00:00:00 2001
From: Vladimir Davydov <vdavydov@tarantool.org>
Date: Mon, 7 Aug 2023 11:18:51 +0300
Subject: [PATCH] test: increase max fiber slice for box/before_replace

The test fails on osx_debug quite frequently with the following error:

NO_WRAP
> box/before_replace.test.lua                                     [ fail ]
>
> Test failed! Result content mismatch:
> --- box/before_replace.result	Mon Aug  7 10:36:06 2023
> +++ /tmp/t/rejects/box/before_replace.reject	Mon Aug  7 10:42:03 2023
> @@ -899,6 +899,7 @@
>  ...
>  for i = 1,17 do gen_inserts() end
>  ---
> +- error: fiber slice is exceeded
>  ...
>  test_run:cmd('restart server test')
>  s = box.space.test_on_schema_init
> @@ -906,7 +907,7 @@
>  ...
>  s:count()
>  ---
> -- 1
> +- 0
>  ...
>  -- For this test the number of invocations of the before_replace
>  -- trigger during recovery multiplied by the amount of return values
> @@ -921,7 +922,8 @@
>  -- the value is only increased by 1, and this change is visible only in memory.
>  s:get{1}[2] == 1 + 16999 + 17000 + 1 or s:get{1}[2]
>  ---
> -- true
> +- error: '[string "return s:get{1}[2] == 1 + 16999 + 17000 + 1 o..."]:1: attempt to
> +    index a nil value'
>  ...
>  test_run:cmd('switch default')
>  ---
NO_WRAP

Let's try to increase the max fiber slice up to 15 seconds to avoid
that, like we do in other potentially long tests. (The default value
is 1 second.)

NO_DOC=test fix
NO_CHANGELOG=test fix
---
 test/box/before_replace.result   | 3 +++
 test/box/before_replace.test.lua | 1 +
 2 files changed, 4 insertions(+)

diff --git a/test/box/before_replace.result b/test/box/before_replace.result
index 5e75be41e9..34c94dcb7e 100644
--- a/test/box/before_replace.result
+++ b/test/box/before_replace.result
@@ -874,6 +874,9 @@ test_run:cmd('switch test')
 ---
 - true
 ...
+require('fiber').set_max_slice(15)
+---
+...
 s = box.schema.space.create('test_on_schema_init')
 ---
 ...
diff --git a/test/box/before_replace.test.lua b/test/box/before_replace.test.lua
index ca41b2d7ae..a29a0f1e9e 100644
--- a/test/box/before_replace.test.lua
+++ b/test/box/before_replace.test.lua
@@ -314,6 +314,7 @@ s:drop()
 test_run:cmd('create server test with script="box/on_schema_init.lua"')
 test_run:cmd('start server test')
 test_run:cmd('switch test')
+require('fiber').set_max_slice(15)
 s = box.schema.space.create('test_on_schema_init')
 _ = s:create_index('pk')
 test_run:cmd('setopt delimiter ";"')
-- 
GitLab