Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov <sergeyb@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: Oleg Piskunov <o.piskunov@tarantool.org>
Subject: [Tarantool-patches] [PATCH] Add option to specify snapshot version
Date: Mon, 23 Mar 2020 11:45:13 +0300	[thread overview]
Message-ID: <20200323084513.GA64110@pony.bronevichok.ru> (raw)

GitHub branch: https://github.com/tarantool/test-run/tree/ligurio/gh-4801-add-snapshot-option

Ticket: #4801
---
 lib/options.py          | 7 +++++++
 lib/tarantool_server.py | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/lib/options.py b/lib/options.py
index 8bacb4a..cce3835 100644
--- a/lib/options.py
+++ b/lib/options.py
@@ -201,6 +201,13 @@ class Options:
                 help="""Run the server under 'luacov'.
                 Default: false.""")
 
+        parser.add_argument(
+                "--snapshot-version",
+                dest='snapshot_version',
+                default=None,
+                help="""Version of Tarantool snapshot loaded before
+                testing.""")
+
         # XXX: We can use parser.parse_intermixed_args() on
         # Python 3.7 to understand commands like
         # ./test-run.py foo --exclude bar baz
diff --git a/lib/tarantool_server.py b/lib/tarantool_server.py
index fd102b9..09aee9c 100644
--- a/lib/tarantool_server.py
+++ b/lib/tarantool_server.py
@@ -32,6 +32,7 @@ from lib.utils import format_process
 from lib.utils import signame
 from lib.utils import warn_unix_socket
 from lib.utils import prefix_each_line
+from lib.options import Options
 from test import TestRunGreenlet, TestExecutionError
 
 
@@ -767,6 +768,14 @@ class TarantoolServer(Server):
                     if (e.errno == errno.ENOENT):
                         continue
                     raise
+
+        snapshot_basename = Options().args.snapshot_version
+        if snapshot_basename:
+            snapshot_name = '{}.snap'.format(snapshot_basename)
+            snapshot_path = os.path.join(self.testdir, 'static/snapshots', snapshot_name)
+            color_log("Copy snapshot: {}".format(snapshot_name))
+            os.mkdir(os.path.join(self.vardir, 'box'))
+            shutil.copy(snapshot_path, os.path.join(self.vardir, 'box/00000000000000000001.snap'))
         shutil.copy('.tarantoolctl', self.vardir)
         shutil.copy(os.path.join(self.TEST_RUN_DIR, 'test_run.lua'),
                     self.vardir)
-- 
2.23.0


-- 
sergeyb@

             reply	other threads:[~2020-03-23  8:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  8:45 Sergey Bronnikov [this message]
2020-03-23 15:02 ` Sergey Bronnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200323084513.GA64110@pony.bronevichok.ru \
    --to=sergeyb@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] Add option to specify snapshot version' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox