* [Tarantool-patches] [PATCH] Add option to specify snapshot version
@ 2020-03-23 8:45 Sergey Bronnikov
2020-03-23 15:02 ` Sergey Bronnikov
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Bronnikov @ 2020-03-23 8:45 UTC (permalink / raw)
To: tarantool-patches; +Cc: Oleg Piskunov
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@
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Tarantool-patches] [PATCH] Add option to specify snapshot version
2020-03-23 8:45 [Tarantool-patches] [PATCH] Add option to specify snapshot version Sergey Bronnikov
@ 2020-03-23 15:02 ` Sergey Bronnikov
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Bronnikov @ 2020-03-23 15:02 UTC (permalink / raw)
To: tarantool-patches; +Cc: Oleg Piskunov
please ignore the patch, I'll send new version.
On 11:45 Mon 23 Mar , Sergey Bronnikov wrote:
> 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@
--
sergeyb@
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-23 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 8:45 [Tarantool-patches] [PATCH] Add option to specify snapshot version Sergey Bronnikov
2020-03-23 15:02 ` Sergey Bronnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox