From f50c9b5da347efad345c309b6a2c4e357d323431 Mon Sep 17 00:00:00 2001
From: Gleb Kashkin <g.kashkin@tarantool.org>
Date: Sun, 3 Sep 2023 19:17:13 +0000
Subject: [PATCH] test/config: upgrade reload_success_case() helper

This helpers does the following:
1. starts a server
2. writes a script/config
3. verifies invariants
4. writes a new script/config
5. reloads
6. verifies invariants after reload

This patch allows to set not only script, but config too on the step 4,
before the reload.

Part of #8967

NO_DOC=test helper upgrade
NO_CHANGELOG=see NO_DOC
NO_TEST=see NO_DOC
---
 test/config-luatest/helpers.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/config-luatest/helpers.lua b/test/config-luatest/helpers.lua
index 534a21bcf5..f998f31db6 100644
--- a/test/config-luatest/helpers.lua
+++ b/test/config-luatest/helpers.lua
@@ -196,6 +196,11 @@ end
 --   A new script to write into the main.lua file before
 --   config:reload().
 --
+-- * opts.options_2
+--
+--   A new config to use for the config:reload(). It is optional,
+--   if not provided opts.options is used instead.
+--
 -- * opts.verify_2
 --
 --   Verify test invariants after config:reload().
@@ -203,13 +208,14 @@ local function reload_success_case(g, opts)
     local script_2 = opts.script_2
     local options = assert(opts.options)
     local verify_2 = assert(opts.verify_2)
+    local options_2 = opts.options_2 or options
 
     local prepared = success_case(g, opts)
 
     prepare_case(g, {
         dir = prepared.dir,
         script = script_2,
-        options = options,
+        options = options_2,
     })
     g.server:exec(function()
         local config = require('config')
-- 
GitLab