From cce9fdb43baebf0ed3cccfbbf55b34a847446b57 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Tue, 9 Jul 2024 15:18:04 +0700 Subject: [PATCH] Move clt-tests under test directory and update CLT version to the latest one --- .github/workflows/clt.yml | 3 +- .gitignore | 4 +- {tests => test/clt-tests}/backup-all-ok.rec | 0 test/clt-tests/backup-all-ok.rep | 139 +++++++++++++ {tests => test/clt-tests}/backup-conf.rec | 0 test/clt-tests/backup-conf.rep | 112 ++++++++++ {tests => test/clt-tests}/backup-fails.rec | 0 test/clt-tests/backup-fails.rep | 128 ++++++++++++ test/clt-tests/backup-restore-ok.cmp | 162 +++++++++++++++ .../clt-tests}/backup-restore-ok.rec | 0 test/clt-tests/backup-restore-ok.rep | 193 ++++++++++++++++++ .../clt-tests}/backup-shebang-config-ok.rec | 2 +- test/clt-tests/backup-shebang-config-ok.rep | 86 ++++++++ .../clt-tests}/backup-single-table-ok.rec | 0 test/clt-tests/backup-single-table-ok.rep | 141 +++++++++++++ .../backup-works-with-max-connections.rec | 2 +- .../backup-works-with-max-connections.rep | 138 +++++++++++++ .../clt-tests}/config/manticore-vip.conf | 0 .../clt-tests}/config/manticore.conf | 0 {tests => test/clt-tests}/config/manticore.sh | 0 {tests => test/clt-tests}/dumps/tables.sql | 0 test/clt-tests/help.cmp | 55 +++++ {tests => test/clt-tests}/help.rec | 0 test/clt-tests/help.rep | 49 +++++ {tests => test/clt-tests}/init-database.recb | 2 +- {tests => test/clt-tests}/start-searchd.recb | 2 +- 26 files changed, 1211 insertions(+), 7 deletions(-) rename {tests => test/clt-tests}/backup-all-ok.rec (100%) create mode 100644 test/clt-tests/backup-all-ok.rep rename {tests => test/clt-tests}/backup-conf.rec (100%) create mode 100644 test/clt-tests/backup-conf.rep rename {tests => test/clt-tests}/backup-fails.rec (100%) create mode 100644 test/clt-tests/backup-fails.rep create mode 100644 test/clt-tests/backup-restore-ok.cmp rename {tests => test/clt-tests}/backup-restore-ok.rec (100%) create mode 100644 test/clt-tests/backup-restore-ok.rep rename {tests => test/clt-tests}/backup-shebang-config-ok.rec (98%) create mode 100644 test/clt-tests/backup-shebang-config-ok.rep rename {tests => test/clt-tests}/backup-single-table-ok.rec (100%) create mode 100644 test/clt-tests/backup-single-table-ok.rep rename {tests => test/clt-tests}/backup-works-with-max-connections.rec (98%) create mode 100644 test/clt-tests/backup-works-with-max-connections.rep rename {tests => test/clt-tests}/config/manticore-vip.conf (100%) rename {tests => test/clt-tests}/config/manticore.conf (100%) rename {tests => test/clt-tests}/config/manticore.sh (100%) rename {tests => test/clt-tests}/dumps/tables.sql (100%) create mode 100644 test/clt-tests/help.cmp rename {tests => test/clt-tests}/help.rec (100%) create mode 100644 test/clt-tests/help.rep rename {tests => test/clt-tests}/init-database.recb (50%) rename {tests => test/clt-tests}/start-searchd.recb (93%) diff --git a/.github/workflows/clt.yml b/.github/workflows/clt.yml index 7223460..b049047 100644 --- a/.github/workflows/clt.yml +++ b/.github/workflows/clt.yml @@ -10,10 +10,11 @@ jobs: clt: runs-on: ubuntu-22.04 steps: - - uses: manticoresoftware/clt@0.1.21 + - uses: manticoresoftware/clt@0.2.1 with: image: 'ghcr.io/manticoresoftware/manticoresearch:test-kit-latest' init_code: | git clone https://github.com/manticoresoftware/phar_builder.git ./phar_builder/bin/build --name="Manticore Backup" --package="manticore-backup" run_args: '-v $PWD/build/manticore-backup:/usr/bin/manticore-backup -v $PWD/build/share/modules/manticore-backup:/usr/share/manticore/modules/manticore-backup' + test_prefix: test/clt-tests/ diff --git a/.gitignore b/.gitignore index 791180d..b573a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ vendor/** .phpunit.result.cache phar_builder clt -tests/*.rep -tests/*.cmp +test/clt-tests/*.rep +test/clt-tests/*.cmp diff --git a/tests/backup-all-ok.rec b/test/clt-tests/backup-all-ok.rec similarity index 100% rename from tests/backup-all-ok.rec rename to test/clt-tests/backup-all-ok.rec diff --git a/test/clt-tests/backup-all-ok.rep b/test/clt-tests/backup-all-ok.rep new file mode 100644 index 0000000..fb89951 --- /dev/null +++ b/test/clt-tests/backup-all-ok.rep @@ -0,0 +1,139 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 410ms +––– input ––– +cp ./test/clt-tests/config/manticore.conf /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 2ms (0.49%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:31.566] [29] using config file '/etc/manticoresearch/manticore.conf' (273 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +––– duration: 106ms (25.85%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (3.90%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 7ms (1.71%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– duration: 6ms (1.46%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table distributed_index' +––– output ––– ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| distributed_index | CREATE TABLE distributed_index type='distributed' local='rt_with_columnar' agent='127.0.0.1:9312:plain_with_columnar, plain_without_columnar' | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 5ms (1.22%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table rt_with_columnar' +––– output ––– ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_with_columnar | CREATE TABLE rt_with_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute engine='columnar', +tags multi, +attributes json +) | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 9ms (2.20%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table rt_without_columnar' +––– output ––– ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_without_columnar | CREATE TABLE rt_without_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute, +tags multi, +attributes json +) | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 8ms (1.95%) ––– +––– input ––– +ls -lt /tmp/backup-* +––– output ––– +ls: cannot access '/tmp/backup-*': No such file or directory +––– duration: 4ms (0.98%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp +Manticore config +endpoint = http://127.0.0.1:9312 +Manticore versions: +manticore: 6.2.13 5de07b0ae@24022215 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-22 11:44:31 [Info] Starting the backup... +2024-02-22 11:44:31 [Info] Backing up config files... +2024-02-22 11:44:31 [Info] config files - OK +2024-02-22 11:44:31 [Info] Backing up global state files... +2024-02-22 11:44:31 [Info] global state files – OK +2024-02-22 11:44:31 [Info] Backing up tables... +2024-02-22 11:44:31 [Info] distributed_index (distributed)... +2024-02-22 11:44:31 [Info] SKIP +2024-02-22 11:44:31 [Info] rt_with_columnar (rt) [2.915K]... +2024-02-22 11:44:31 [Info] OK +2024-02-22 11:44:31 [Info] rt_without_columnar (rt) [2.789K]... +2024-02-22 11:44:31 [Info] OK +2024-02-22 11:44:31 [Info] Running sync +2024-02-22 11:44:31 [Info] OK +2024-02-22 11:44:31 [Info] You can find backup here: /tmp/backup-20240222114431 +2024-02-22 11:44:31 [Info] Elapsed time: 0.01s +2024-02-22 11:44:31 [Info] Done +2024-02-22 11:44:31 [Info] +Unfreezing all tables... +2024-02-22 11:44:31 [Info] distributed_index... +2024-02-22 11:44:31 [Info] OK +2024-02-22 11:44:31 [Info] rt_with_columnar... +2024-02-22 11:44:31 [Info] OK +2024-02-22 11:44:31 [Info] rt_without_columnar... +2024-02-22 11:44:31 [Info] OK +––– duration: 242ms (59.02%) ––– +––– input ––– +ls -lh /tmp/backup-* +––– output ––– +total 16K +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 config +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 data +drwxr-xr-x. 2 root root 4.0K Feb 22 11:44 state +-rw-r--r--. 1 root root 176 Feb 22 11:44 versions.json +––– duration: 5ms (1.22%) ––– diff --git a/tests/backup-conf.rec b/test/clt-tests/backup-conf.rec similarity index 100% rename from tests/backup-conf.rec rename to test/clt-tests/backup-conf.rec diff --git a/test/clt-tests/backup-conf.rep b/test/clt-tests/backup-conf.rep new file mode 100644 index 0000000..636e39e --- /dev/null +++ b/test/clt-tests/backup-conf.rep @@ -0,0 +1,112 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 429ms +––– input ––– +cp /etc/manticoresearch/manticore.conf /tmp/ +––– output ––– +––– duration: 2ms (0.47%) ––– +––– input ––– +cp ./test/clt-tests/config/manticore.conf /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 2ms (0.47%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 d6f2c7d84@24022421 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[03:14.971] [30] using config file '/etc/manticoresearch/manticore.conf' (273 chars)... +starting daemon version '6.2.13 d6f2c7d84@24022421 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +––– duration: 107ms (24.94%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (3.73%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 8ms (1.86%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 18ms (4.20%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | +| test | rt | ++---------------------+-------------+ +––– duration: 9ms (2.10%) ––– +––– input ––– +manticore-backup --config=/etc/manticoresearch/manticore.conf --config=/tmp/manticore.conf --backup-dir=/tmp/ +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp/ +Manticore config +endpoint = http://127.0.0.1:9312 +Manticore config +endpoint = http://127.0.0.1:9312 +Manticore versions: +manticore: 6.2.13 d6f2c7d84@24022421 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-27 13:03:15 [Info] Starting the backup... +2024-02-27 13:03:15 [Info] Backing up config files... +2024-02-27 13:03:15 [Info] config files - OK +2024-02-27 13:03:15 [Info] Backing up global state files... +2024-02-27 13:03:15 [Info] global state files – OK +2024-02-27 13:03:15 [Info] Backing up tables... +2024-02-27 13:03:15 [Info] distributed_index (distributed)... +2024-02-27 13:03:15 [Info] SKIP +2024-02-27 13:03:15 [Info] rt_with_columnar (rt) [2.915K]... +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] rt_without_columnar (rt) [2.789K]... +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] test (rt) [956B]... +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] Running sync +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] You can find backup here: /tmp/backup-20240227130315 +2024-02-27 13:03:15 [Info] Elapsed time: 0.01s +2024-02-27 13:03:15 [Info] Done +2024-02-27 13:03:15 [Info] +Unfreezing all tables... +2024-02-27 13:03:15 [Info] distributed_index... +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] rt_with_columnar... +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] rt_without_columnar... +2024-02-27 13:03:15 [Info] OK +2024-02-27 13:03:15 [Info] test... +2024-02-27 13:03:15 [Info] OK +––– duration: 245ms (57.11%) ––– +––– input ––– +rm /etc/manticoresearch/manticore.conf; rm /tmp/manticore.conf +––– output ––– +––– duration: 3ms (0.70%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp/ --restore +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp/ +Available backups: 1 +backup-20240227130315 (Feb 27 2024 13:03:15) +––– duration: 19ms (4.43%) ––– diff --git a/tests/backup-fails.rec b/test/clt-tests/backup-fails.rec similarity index 100% rename from tests/backup-fails.rec rename to test/clt-tests/backup-fails.rec diff --git a/test/clt-tests/backup-fails.rep b/test/clt-tests/backup-fails.rep new file mode 100644 index 0000000..c7c0d8f --- /dev/null +++ b/test/clt-tests/backup-fails.rep @@ -0,0 +1,128 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 229ms +––– input ––– +cp ./test/clt-tests/config/manticore.conf /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 2ms (0.87%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:32.476] [29] using config file '/etc/manticoresearch/manticore.conf' (273 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +––– duration: 106ms (46.29%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (6.99%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 7ms (3.06%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– duration: 5ms (2.18%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table distributed_index' +––– output ––– ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| distributed_index | CREATE TABLE distributed_index type='distributed' local='rt_with_columnar' agent='127.0.0.1:9312:plain_with_columnar, plain_without_columnar' | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 4ms (1.75%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table rt_with_columnar' +––– output ––– ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_with_columnar | CREATE TABLE rt_with_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute engine='columnar', +tags multi, +attributes json +) | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 8ms (3.49%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table rt_without_columnar' +––– output ––– ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_without_columnar | CREATE TABLE rt_without_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute, +tags multi, +attributes json +) | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 7ms (3.06%) ––– +––– input ––– +ls -lt /tmp/non-exist +––– output ––– +ls: cannot access '/tmp/non-exist': No such file or directory +––– duration: 4ms (1.75%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp/non-exist +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +2024-02-22 11:44:32 [Error] Failed to find backup dir to store backup: /tmp/non-exist +––– duration: 21ms (9.17%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --tables=none +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: none +Backup dir: /tmp +Manticore config +endpoint = http://127.0.0.1:9312 +Manticore versions: +manticore: 6.2.13 5de07b0ae@24022215 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-22 11:44:32 [Info] Starting the backup... +2024-02-22 11:44:32 [Error] Can't find some of the tables: none +––– duration: 24ms (10.48%) ––– +––– input ––– +pgrep -f searchd | xargs kill +––– output ––– +––– duration: 3ms (1.31%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp +Manticore config +endpoint = http://127.0.0.1:9312 +2024-02-22 11:44:32 [Error] Failed to send query to the Manticore Search daemon. Ensure that it is set up to listen for HTTP or HTTPS connections and has the appropriate certificates in place. Additionally, check the 'max_connections' setting in the configuration file to ensure that it has not been exceeded. +––– duration: 22ms (9.61%) ––– diff --git a/test/clt-tests/backup-restore-ok.cmp b/test/clt-tests/backup-restore-ok.cmp new file mode 100644 index 0000000..0850eee --- /dev/null +++ b/test/clt-tests/backup-restore-ok.cmp @@ -0,0 +1,162 @@ +––– input ––– +searchd +––– output ––– +Manticore %{SEMVER} %{COMMITDATE} dev (columnar %{SEMVER} #!/[a-f0-9]{7}@[0-9]{6}/!#) (secondary %{SEMVER} #!/[a-f0-9]{7}@[0-9]{6}/!#) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com) +[#!/[0-9]{2}:[0-9]{2}\.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/etc/manticoresearch/manticore.conf' (#!/[0-9]+/!# chars)... +starting daemon version '%{SEMVER} %{COMMITDATE} dev (columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE})' ... +listening on all interfaces for mysql, port=9306 +listening on UNIX socket /var/run/mysqld/mysqld.sock +listening on #!/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:9312|all interfaces/!# for sphinx and http(s) +listening on #!/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:9308|all interfaces/!# for sphinx and http(s) +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– input ––– +manticore-backup --backup-dir=/tmp +––– output ––– +Copyright (c) %{YEAR}, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp +Manticore config +endpoint = http://%{IPADDR}:9312 +Manticore versions: +manticore: %{SEMVER} %{COMMITDATE} dev +columnar: %{SEMVER} %{COMMITDATE} +secondary: %{SEMVER} %{COMMITDATE} +Manticore versions: +manticore: %{SEMVER} %{COMMITDATE} dev +columnar: %{SEMVER} %{COMMITDATE} +secondary: %{SEMVER} %{COMMITDATE} +%{DATETIME} [Info] Starting the backup... +%{DATETIME} [Info] Backing up config files... +%{DATETIME} [Info] config files - OK +%{DATETIME} [Info] Backing up global state files... +%{DATETIME} [Info] global state files – OK +%{DATETIME} [Info] Backing up tables... +%{DATETIME} [Info] SKIP +%{DATETIME} [Info] %{DATETIME} [Info] rt_with_columnar (rt) [2.884K]... +%{DATETIME} [Info] OK +%{DATETIME} [Info] rt_without_columnar (rt) [2.758K]... +%{DATETIME} [Info] OK +%{DATETIME} [Info] Running sync +%{DATETIME} [Info] OK +%{DATETIME} [Info] You can find backup here: /tmp/backup-#!/[0-9]{14}/!# +%{DATETIME} [Info] Elapsed time: #!/[0-9]+/!#.#!/[0-9]+/!#s +%{DATETIME} [Info] Done +%{DATETIME} [Info] +Unfreezing all tables... +%{DATETIME} [Info] distributed_index... +%{DATETIME} [Info] OK +%{DATETIME} [Info] rt_with_columnar... +%{DATETIME} [Info] OK +%{DATETIME} [Info] rt_without_columnar... +%{DATETIME} [Info] OK +––– input ––– +mv /tmp/backup-* /tmp/backup-111 +––– output ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore +––– output ––– +Copyright (c) %{YEAR}, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +Available backups: 1 +backup-111 (?) +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) %{YEAR}, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +%{DATETIME} [Info] Starting to restore... +%{DATETIME} [Error] Cannot initiate the restore process due to searchd daemon is running. +––– input ––– +pgrep -f searchd | xargs kill +––– output ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) %{YEAR}, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +%{DATETIME} [Info] Starting to restore... +Manticore config +endpoint = http://%{IPADDR}:9312 +%{DATETIME} [Error] Destination file already exists: /etc/manticoresearch/manticore.conf +––– input ––– +rm /etc/manticoresearch/manticore.conf +––– output ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) %{YEAR}, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +%{DATETIME} [Info] Starting to restore... +Manticore config +endpoint = http://%{IPADDR}:9312 +%{DATETIME} [Error] Destination file already exists: /var/lib/manticore/manticore.json +––– input ––– +rm -fr /var/lib/manticore/* +––– output ––– +––– input ––– +rm -fr /usr/local/lib/manticore/buddy-plugins +––– output ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) %{YEAR}, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +%{DATETIME} [Info] Starting to restore... +Manticore config +endpoint = http://%{IPADDR}:9312 +%{DATETIME} [Info] Restoring config files... +%{DATETIME} [Info] config files - OK +%{DATETIME} [Info] Restoring state files... +%{DATETIME} [Info] state files - OK +%{DATETIME} [Info] Restoring data files... +%{DATETIME} [Info] tables' files - OK +%{DATETIME} [Info] The backup '/tmp/backup-111' was successfully restored. +%{DATETIME} [Info] Elapsed time: #!/[0-9]+/!#.#!/[0-9]+/!#s +%{DATETIME} [Info] Done +––– input ––– +searchd +––– output ––– +Manticore %{SEMVER} %{COMMITDATE} dev (columnar %{SEMVER} #!/[a-f0-9]{7}@[0-9]{6}/!#) (secondary %{SEMVER} #!/[a-f0-9]{7}@[0-9]{6}/!#) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com) +[#!/[0-9]{2}:[0-9]{2}\.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/etc/manticoresearch/manticore.conf' (#!/[0-9]+/!# chars)... +starting daemon version '%{SEMVER} %{COMMITDATE} dev (columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE})' ... +listening on all interfaces for mysql, port=9306 +listening on UNIX socket /var/run/mysqld/mysqld.sock +listening on #!/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:9312|all interfaces/!# for sphinx and http(s) +listening on #!/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:9308|all interfaces/!# for sphinx and http(s) +precaching table 'rt_with_columnar' +precaching table 'rt_without_columnar' +precached 2 tables in 0.#!/[0-9]{3}/!# sec +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ diff --git a/tests/backup-restore-ok.rec b/test/clt-tests/backup-restore-ok.rec similarity index 100% rename from tests/backup-restore-ok.rec rename to test/clt-tests/backup-restore-ok.rec diff --git a/test/clt-tests/backup-restore-ok.rep b/test/clt-tests/backup-restore-ok.rep new file mode 100644 index 0000000..4a5da62 --- /dev/null +++ b/test/clt-tests/backup-restore-ok.rep @@ -0,0 +1,193 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 841ms +––– input ––– +cp ./test/clt-tests/config/manticore.conf /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 3ms (0.36%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:33.190] [29] using config file '/etc/manticoresearch/manticore.conf' (273 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +––– duration: 106ms (12.60%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (1.90%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 7ms (0.83%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– duration: 6ms (0.71%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp +Manticore config +endpoint = http://127.0.0.1:9312 +Manticore versions: +manticore: 6.2.13 5de07b0ae@24022215 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-22 11:44:33 [Info] Starting the backup... +2024-02-22 11:44:33 [Info] Backing up config files... +2024-02-22 11:44:33 [Info] config files - OK +2024-02-22 11:44:33 [Info] Backing up global state files... +2024-02-22 11:44:33 [Info] global state files – OK +2024-02-22 11:44:33 [Info] Backing up tables... +2024-02-22 11:44:33 [Info] distributed_index (distributed)... +2024-02-22 11:44:33 [Info] SKIP +2024-02-22 11:44:33 [Info] rt_with_columnar (rt) [2.915K]... +2024-02-22 11:44:33 [Info] OK +2024-02-22 11:44:33 [Info] rt_without_columnar (rt) [2.789K]... +2024-02-22 11:44:33 [Info] OK +2024-02-22 11:44:33 [Info] Running sync +2024-02-22 11:44:33 [Info] OK +2024-02-22 11:44:33 [Info] You can find backup here: /tmp/backup-20240222114433 +2024-02-22 11:44:33 [Info] Elapsed time: 0.01s +2024-02-22 11:44:33 [Info] Done +2024-02-22 11:44:33 [Info] +Unfreezing all tables... +2024-02-22 11:44:33 [Info] distributed_index... +2024-02-22 11:44:33 [Info] OK +2024-02-22 11:44:33 [Info] rt_with_columnar... +2024-02-22 11:44:33 [Info] OK +2024-02-22 11:44:33 [Info] rt_without_columnar... +2024-02-22 11:44:33 [Info] OK +––– duration: 256ms (30.44%) ––– +––– input ––– +mv /tmp/backup-* /tmp/backup-111 +––– output ––– +––– duration: 2ms (0.24%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +Available backups: 1 +backup-111 (?) +––– duration: 19ms (2.26%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +2024-02-22 11:44:33 [Info] Stored versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"2.1.7"} +2024-02-22 11:44:33 [Info] Current versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"0.0.0"} +2024-02-22 11:44:33 [Info] Starting to restore... +2024-02-22 11:44:33 [Error] Cannot initiate the restore process due to searchd daemon is running. +––– duration: 25ms (2.97%) ––– +––– input ––– +pgrep -f searchd | xargs kill -9 +––– output ––– +––– duration: 4ms (0.48%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +2024-02-22 11:44:33 [Info] Stored versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"2.1.7"} +2024-02-22 11:44:33 [Info] Current versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"0.0.0"} +2024-02-22 11:44:33 [Info] Starting to restore... +Manticore config +endpoint = http://127.0.0.1:9312 +2024-02-22 11:44:33 [Error] Destination file already exists: /etc/manticoresearch/manticore.conf +––– duration: 29ms (3.45%) ––– +––– input ––– +rm /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 3ms (0.36%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +2024-02-22 11:44:33 [Info] Stored versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"2.1.7"} +2024-02-22 11:44:33 [Info] Current versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"0.0.0"} +2024-02-22 11:44:33 [Info] Starting to restore... +Manticore config +endpoint = http://127.0.0.1:9312 +2024-02-22 11:44:33 [Error] Destination file already exists: /var/lib/manticore/manticore.json +––– duration: 26ms (3.09%) ––– +––– input ––– +rm -fr /var/lib/manticore && mkdir -p /var/lib/manticore +––– output ––– +––– duration: 3ms (0.36%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --restore=backup-111 +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: +Backup dir: /tmp +2024-02-22 11:44:33 [Info] Stored versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"2.1.7"} +2024-02-22 11:44:33 [Info] Current versions: {"backup":"1.3.5","manticore":"6.2.13 5de07b0ae@24022215 dev","columnar":"2.2.5 a5342a1@240217","secondary":"2.2.5 a5342a1@240217","knn":"2.2.5 a5342a1@240217","buddy":"0.0.0"} +2024-02-22 11:44:33 [Info] Starting to restore... +Manticore config +endpoint = http://127.0.0.1:9312 +2024-02-22 11:44:33 [Info] Restoring config files... +2024-02-22 11:44:33 [Info] config files - OK +2024-02-22 11:44:33 [Info] Restoring state files... +2024-02-22 11:44:33 [Info] state files - OK +2024-02-22 11:44:33 [Info] Restoring data files... +2024-02-22 11:44:33 [Info] tables' files - OK +2024-02-22 11:44:33 [Info] The backup '/tmp/backup-111' was successfully restored. +2024-02-22 11:44:33 [Info] Elapsed time: 0.01s +2024-02-22 11:44:33 [Info] Done +––– duration: 224ms (26.63%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:33.922] [181] using config file '/etc/manticoresearch/manticore.conf' (273 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +precaching table 'rt_with_columnar' +precaching table 'rt_without_columnar' +WARNING: table 'distributed_index': ha_strategy defined, but no ha agents in the table +precached 2 tables in 0.001 sec +––– duration: 106ms (12.60%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– duration: 6ms (0.71%) ––– diff --git a/tests/backup-shebang-config-ok.rec b/test/clt-tests/backup-shebang-config-ok.rec similarity index 98% rename from tests/backup-shebang-config-ok.rec rename to test/clt-tests/backup-shebang-config-ok.rec index 98bf49d..7cfd516 100644 --- a/tests/backup-shebang-config-ok.rec +++ b/test/clt-tests/backup-shebang-config-ok.rec @@ -1,5 +1,5 @@ ––– input ––– -cp tests/config/manticore.sh /etc/manticoresearch/manticore.conf +cp test/clt-tests/config/manticore.sh /etc/manticoresearch/manticore.conf ––– output ––– ––– input ––– searchd diff --git a/test/clt-tests/backup-shebang-config-ok.rep b/test/clt-tests/backup-shebang-config-ok.rep new file mode 100644 index 0000000..2f77736 --- /dev/null +++ b/test/clt-tests/backup-shebang-config-ok.rep @@ -0,0 +1,86 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 381ms +––– input ––– +cp test/clt-tests/config/manticore.sh /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 2ms (0.52%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:34.537] [29] using config file '/etc/manticoresearch/manticore.conf' (9274 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on all interfaces for mysql, port=9306 +listening on UNIX socket /var/run/mysqld/mysqld.sock +listening on 172.17.0.7:9312 for sphinx and http(s) +listening on all interfaces for sphinx and http(s), port=9308 +––– duration: 107ms (28.08%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (4.20%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 7ms (1.84%) ––– +––– input ––– +ls -lt /tmp/backup-* +––– output ––– +ls: cannot access '/tmp/backup-*': No such file or directory +––– duration: 4ms (1.05%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp +Manticore config +endpoint = http://172.17.0.7:9312 +Manticore versions: +manticore: 6.2.13 5de07b0ae@24022215 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-22 11:44:34 [Info] Starting the backup... +2024-02-22 11:44:34 [Info] Backing up config files... +2024-02-22 11:44:34 [Info] config files - OK +2024-02-22 11:44:34 [Info] Backing up global state files... +2024-02-22 11:44:34 [Info] global state files – OK +2024-02-22 11:44:34 [Info] Backing up tables... +2024-02-22 11:44:34 [Info] distributed_index (distributed)... +2024-02-22 11:44:34 [Info] SKIP +2024-02-22 11:44:34 [Info] rt_with_columnar (rt) [2.915K]... +2024-02-22 11:44:34 [Info] OK +2024-02-22 11:44:34 [Info] rt_without_columnar (rt) [2.789K]... +2024-02-22 11:44:34 [Info] OK +2024-02-22 11:44:34 [Info] Running sync +2024-02-22 11:44:34 [Info] OK +2024-02-22 11:44:34 [Info] You can find backup here: /tmp/backup-20240222114434 +2024-02-22 11:44:34 [Info] Elapsed time: 0.01s +2024-02-22 11:44:34 [Info] Done +2024-02-22 11:44:34 [Info] +Unfreezing all tables... +2024-02-22 11:44:34 [Info] distributed_index... +2024-02-22 11:44:34 [Info] OK +2024-02-22 11:44:34 [Info] rt_with_columnar... +2024-02-22 11:44:34 [Info] OK +2024-02-22 11:44:34 [Info] rt_without_columnar... +2024-02-22 11:44:34 [Info] OK +––– duration: 240ms (62.99%) ––– +––– input ––– +ls -lh /tmp/backup-* +––– output ––– +total 16K +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 config +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 data +drwxr-xr-x. 3 root root 4.0K Feb 22 11:44 state +-rw-r--r--. 1 root root 176 Feb 22 11:44 versions.json +––– duration: 5ms (1.31%) ––– diff --git a/tests/backup-single-table-ok.rec b/test/clt-tests/backup-single-table-ok.rec similarity index 100% rename from tests/backup-single-table-ok.rec rename to test/clt-tests/backup-single-table-ok.rec diff --git a/test/clt-tests/backup-single-table-ok.rep b/test/clt-tests/backup-single-table-ok.rep new file mode 100644 index 0000000..25ee32b --- /dev/null +++ b/test/clt-tests/backup-single-table-ok.rep @@ -0,0 +1,141 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 438ms +––– input ––– +cp ./test/clt-tests/config/manticore.conf /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 3ms (0.68%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:35.418] [29] using config file '/etc/manticoresearch/manticore.conf' (273 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +––– duration: 106ms (24.20%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (3.65%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 7ms (1.60%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– duration: 4ms (0.91%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table distributed_index' +––– output ––– ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| distributed_index | CREATE TABLE distributed_index type='distributed' local='rt_with_columnar' agent='127.0.0.1:9312:plain_with_columnar, plain_without_columnar' | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 4ms (0.91%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table rt_with_columnar' +––– output ––– ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_with_columnar | CREATE TABLE rt_with_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute engine='columnar', +tags multi, +attributes json +) | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 5ms (1.14%) ––– +––– input ––– +mysql -h0 -P9306 -e 'show create table rt_without_columnar' +––– output ––– ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_without_columnar | CREATE TABLE rt_without_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute, +tags multi, +attributes json +) | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 8ms (1.83%) ––– +––– input ––– +ls -lt /tmp/backup-* +––– output ––– +ls: cannot access '/tmp/backup-*': No such file or directory +––– duration: 4ms (0.91%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp --tables=rt_without_columnar +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: rt_without_columnar +Backup dir: /tmp +Manticore config +endpoint = http://127.0.0.1:9312 +Manticore versions: +manticore: 6.2.13 5de07b0ae@24022215 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-22 11:44:35 [Info] Starting the backup... +2024-02-22 11:44:35 [Info] Backing up config files... +2024-02-22 11:44:35 [Info] config files - OK +2024-02-22 11:44:35 [Info] Backing up tables... +2024-02-22 11:44:35 [Info] rt_without_columnar (rt) [2.789K]... +2024-02-22 11:44:35 [Info] OK +2024-02-22 11:44:35 [Info] Running sync +2024-02-22 11:44:35 [Info] OK +2024-02-22 11:44:35 [Info] You can find backup here: /tmp/backup-20240222114435 +2024-02-22 11:44:35 [Info] Elapsed time: 0.01s +2024-02-22 11:44:35 [Info] Done +2024-02-22 11:44:35 [Info] +Unfreezing all tables... +2024-02-22 11:44:35 [Info] distributed_index... +2024-02-22 11:44:35 [Info] OK +2024-02-22 11:44:35 [Info] rt_with_columnar... +2024-02-22 11:44:35 [Info] OK +2024-02-22 11:44:35 [Info] rt_without_columnar... +2024-02-22 11:44:35 [Info] OK +––– duration: 273ms (62.33%) ––– +––– input ––– +ls -lh /tmp/backup-* +––– output ––– +total 16K +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 config +drwxr-xr-x. 3 root root 4.0K Feb 22 11:44 data +drwxr-xr-x. 2 root root 4.0K Feb 22 11:44 state +-rw-r--r--. 1 root root 176 Feb 22 11:44 versions.json +––– duration: 4ms (0.91%) ––– +––– input ––– +ls -lh /tmp/backup-*/data/* +––– output ––– +total 12K +-rw-------. 1 root root 918 Feb 22 11:44 rt_without_columnar.meta +-rw-------. 1 root root 1.9K Feb 22 11:44 rt_without_columnar.ram +-rw-------. 1 root root 3 Feb 22 11:44 rt_without_columnar.settings +––– duration: 4ms (0.91%) ––– diff --git a/tests/backup-works-with-max-connections.rec b/test/clt-tests/backup-works-with-max-connections.rec similarity index 98% rename from tests/backup-works-with-max-connections.rec rename to test/clt-tests/backup-works-with-max-connections.rec index f77dcbc..b0930b4 100644 --- a/tests/backup-works-with-max-connections.rec +++ b/test/clt-tests/backup-works-with-max-connections.rec @@ -1,5 +1,5 @@ ––– input ––– -cp tests/config/manticore-vip.conf /etc/manticoresearch/manticore.conf +cp test/clt-tests/config/manticore-vip.conf /etc/manticoresearch/manticore.conf ––– output ––– ––– input ––– searchd diff --git a/test/clt-tests/backup-works-with-max-connections.rep b/test/clt-tests/backup-works-with-max-connections.rep new file mode 100644 index 0000000..5e745f6 --- /dev/null +++ b/test/clt-tests/backup-works-with-max-connections.rep @@ -0,0 +1,138 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 459ms +––– input ––– +cp test/clt-tests/config/manticore-vip.conf /etc/manticoresearch/manticore.conf +––– output ––– +––– duration: 3ms (0.65%) ––– +––– input ––– +searchd +––– output ––– +Manticore 6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217) +Copyright (c) 2001-2016, Andrew Aksyonoff +Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) +Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com) +[44:36.358] [29] using config file '/etc/manticoresearch/manticore.conf' (372 chars)... +starting daemon version '6.2.13 5de07b0ae@24022215 dev (columnar 2.2.5 a5342a1@240217) (secondary 2.2.5 a5342a1@240217) (knn 2.2.5 a5342a1@240217)' ... +listening on 127.0.0.1:9312 for sphinx and http(s) +listening on 127.0.0.1:9306 for mysql +listening on 127.0.0.1:9307 for VIP mysql +listening on 127.0.0.1:9308 for sphinx and http(s) +listening on 127.0.0.1:9313 for VIP sphinx and http(s) +––– duration: 107ms (23.31%) ––– +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 16ms (3.49%) ––– +––– input ––– +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql +––– output ––– +––– duration: 8ms (1.74%) ––– +––– input ––– +curl localhost:9312/sql?mode=raw -d 'query=debug sleep 10' & +––– output ––– +[1] 75 +––– duration: 4ms (0.87%) ––– +––– input ––– +mysql -h0 -P9307 -e 'show tables' +––– output ––– ++---------------------+-------------+ +| Index | Type | ++---------------------+-------------+ +| distributed_index | distributed | +| rt_with_columnar | rt | +| rt_without_columnar | rt | ++---------------------+-------------+ +––– duration: 6ms (1.31%) ––– +––– input ––– +mysql -h0 -P9307 -e 'show create table distributed_index' +––– output ––– ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +| distributed_index | CREATE TABLE distributed_index type='distributed' local='rt_with_columnar' agent='127.0.0.1:9312:plain_with_columnar, plain_without_columnar' | ++-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 6ms (1.31%) ––– +––– input ––– +mysql -h0 -P9307 -e 'show create table rt_with_columnar' +––– output ––– ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_with_columnar | CREATE TABLE rt_with_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute engine='columnar', +tags multi, +attributes json +) | ++------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 8ms (1.74%) ––– +––– input ––– +mysql -h0 -P9307 -e 'show create table rt_without_columnar' +––– output ––– ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Table | Create Table | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +| rt_without_columnar | CREATE TABLE rt_without_columnar ( +id bigint, +title text, +category_id integer, +price float, +description string attribute, +tags multi, +attributes json +) | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +––– duration: 4ms (0.87%) ––– +––– input ––– +ls -lt /tmp/backup-* +––– output ––– +ls: cannot access '/tmp/backup-*': No such file or directory +––– duration: 4ms (0.87%) ––– +––– input ––– +manticore-backup --backup-dir=/tmp +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore config file: /etc/manticoresearch/manticore.conf +Tables to backup: all tables +Backup dir: /tmp +Manticore config +endpoint = http://127.0.0.1:9313 +Manticore versions: +manticore: 6.2.13 5de07b0ae@24022215 dev +columnar: 2.2.5 a5342a1@240217 +secondary: 2.2.5 a5342a1@240217 +knn: 2.2.5 a5342a1@240217 +buddy: 2.1.7 +2024-02-22 11:44:36 [Info] Starting the backup... +2024-02-22 11:44:36 [Info] Backing up config files... +2024-02-22 11:44:36 [Info] config files - OK +2024-02-22 11:44:36 [Info] Backing up global state files... +2024-02-22 11:44:36 [Info] global state files – OK +2024-02-22 11:44:36 [Info] Backing up tables... +2024-02-22 11:44:36 [Info] distributed_index (distributed)... +2024-02-22 11:44:36 [Info] SKIP +2024-02-22 11:44:36 [Info] rt_with_columnar (rt) [2.915K]... +2024-02-22 11:44:36 [Info] OK +2024-02-22 11:44:36 [Info] rt_without_columnar (rt) [2.789K]... +2024-02-22 11:44:36 [Info] OK +2024-02-22 11:44:36 [Info] Running sync +2024-02-22 11:44:36 [Info] OK +2024-02-22 11:44:36 [Info] You can find backup here: /tmp/backup-20240222114436 +2024-02-22 11:44:36 [Info] Elapsed time: 0.01s +2024-02-22 11:44:36 [Info] Done +––– duration: 288ms (62.75%) ––– +––– input ––– +ls -lh /tmp/backup-* +––– output ––– +total 16K +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 config +drwxr-xr-x. 4 root root 4.0K Feb 22 11:44 data +drwxr-xr-x. 2 root root 4.0K Feb 22 11:44 state +-rw-r--r--. 1 root root 176 Feb 22 11:44 versions.json +––– duration: 5ms (1.09%) ––– diff --git a/tests/config/manticore-vip.conf b/test/clt-tests/config/manticore-vip.conf similarity index 100% rename from tests/config/manticore-vip.conf rename to test/clt-tests/config/manticore-vip.conf diff --git a/tests/config/manticore.conf b/test/clt-tests/config/manticore.conf similarity index 100% rename from tests/config/manticore.conf rename to test/clt-tests/config/manticore.conf diff --git a/tests/config/manticore.sh b/test/clt-tests/config/manticore.sh similarity index 100% rename from tests/config/manticore.sh rename to test/clt-tests/config/manticore.sh diff --git a/tests/dumps/tables.sql b/test/clt-tests/dumps/tables.sql similarity index 100% rename from tests/dumps/tables.sql rename to test/clt-tests/dumps/tables.sql diff --git a/test/clt-tests/help.cmp b/test/clt-tests/help.cmp new file mode 100644 index 0000000..1c5e99d --- /dev/null +++ b/test/clt-tests/help.cmp @@ -0,0 +1,55 @@ +––– input ––– +manticore-backup --version +––– output ––– +- Copyright (c) %{YEAR}47, Manticore Software LTD (https://manticoresearch.com) ++ Copyright (c) 2023, Manticore Software LTD (https://manticoresearch.com) +- Manticore Backup version: %{SEMVER} ++ Manticore Backup version: 1.0.5 +––– input ––– +manticore-backup --help +––– output ––– +- Copyright (c) %{YEAR}47, Manticore Software LTD (https://manticoresearch.com) ++ Copyright (c) 2023, Manticore Software LTD (https://manticoresearch.com) +Usage: +manticore-backup --backup-dir=path/to/backup [OPTIONS] +--backup-dir=path/to/backup +This is a path to the backup directory where a backup is stored. The +directory must exist. This argument is required and has no default value. +On each backup run, it will create directory `backup-[datetime]` in the +provided directory and will copy all required tables to it. So the backup-dir +is a container of all your backups, and it's safe to run the script multiple +times. +OPTIONS: +--config=path/to/manticore.conf +Path to Manticore config. This is optional and in case it's not passed +we use a default one for your operating system. It's used to get the host +and port to talk with the Manticore daemon. +--tables=table1,table2,... +Semicolon-separated list of tables that you want to backup. +If you want to backup all, just skip this argument. All the provided tables +are supposed to exist in the Manticore instance you are backing up from, +otherwise the backup will fail. +--compress +Whether the backed up files should be compressed. Not by default. +--restore[=backup] +Restore from --backup-dir. Just --restore lists available backups. +- ++ --restore=backup will restore from <--backup-dir>/backup. +- ++ --disable-telemetry +- ++ Pass this flag in case you want to disable sending anonymized metrics to Manticore. You can also use environment variable TELEMETRY=0. +- ++ --unlock +- ++ In rare cases when something goes wrong the tables can be left in +- ++ locked state. Using this argument you can unlock them. +- ++ --version +- ++ Show the current version. +- ++ --help +- ++ Show this help. diff --git a/tests/help.rec b/test/clt-tests/help.rec similarity index 100% rename from tests/help.rec rename to test/clt-tests/help.rec diff --git a/test/clt-tests/help.rep b/test/clt-tests/help.rep new file mode 100644 index 0000000..b324fea --- /dev/null +++ b/test/clt-tests/help.rep @@ -0,0 +1,49 @@ +You can use regex in the output sections. +More info here: https://github.com/manticoresoftware/clt#refine +Time taken for test: 44ms +––– input ––– +manticore-backup --version +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Manticore Backup version: 1.3.5 +––– duration: 22ms (50.00%) ––– +––– input ––– +manticore-backup --help +––– output ––– +Copyright (c) 2023-2024, Manticore Software LTD (https://manticoresearch.com) +Usage: +manticore-backup --backup-dir=path/to/backup [OPTIONS] +--backup-dir=path/to/backup +This is a path to the backup directory where a backup is stored. The +directory must exist. This argument is required and has no default value. +On each backup run, it will create directory `backup-[datetime]` in the +provided directory and will copy all required tables to it. So the backup-dir +is a container of all your backups, and it's safe to run the script multiple +times. +OPTIONS: +--config=path/to/manticore.conf +Path to Manticore config. This is optional and in case it's not passed +we use a default one for your operating system. It's used to get the host +and port to talk with the Manticore daemon. +--tables=table1,table2,... +Semicolon-separated list of tables that you want to backup. +If you want to backup all, just skip this argument. All the provided tables +are supposed to exist in the Manticore instance you are backing up from, +otherwise the backup will fail. +--compress +Whether the backed up files should be compressed. Not by default. +--restore[=backup] +Restore from --backup-dir. Just --restore lists available backups. +--restore=backup will restore from <--backup-dir>/backup. +--force +Skip versions check on restore and gracefully restore the backup. +--disable-telemetry +Pass this flag in case you want to disable sending anonymized metrics to Manticore. You can also use environment variable TELEMETRY=0. +--unlock +In rare cases when something goes wrong the tables can be left in +locked state. Using this argument you can unlock them. +--version +Show the current version. +--help +Show this help. +––– duration: 22ms (50.00%) ––– diff --git a/tests/init-database.recb b/test/clt-tests/init-database.recb similarity index 50% rename from tests/init-database.recb rename to test/clt-tests/init-database.recb index a5fd71f..460c6a8 100644 --- a/tests/init-database.recb +++ b/test/clt-tests/init-database.recb @@ -1,3 +1,3 @@ ––– input ––– -mysql -h0 -P9306 < tests/dumps/tables.sql +mysql -h0 -P9306 < test/clt-tests/dumps/tables.sql ––– output ––– diff --git a/tests/start-searchd.recb b/test/clt-tests/start-searchd.recb similarity index 93% rename from tests/start-searchd.recb rename to test/clt-tests/start-searchd.recb index b5ec51c..b9baa50 100644 --- a/tests/start-searchd.recb +++ b/test/clt-tests/start-searchd.recb @@ -1,5 +1,5 @@ ––– input ––– -cp ./tests/config/manticore.conf /etc/manticoresearch/manticore.conf +cp ./test/clt-tests/config/manticore.conf /etc/manticoresearch/manticore.conf ––– output ––– ––– input ––– searchd