From 6a33e55b6f6eadb667ab818fe73cf1db4ea8c26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 2 Oct 2017 10:55:00 +0300 Subject: [PATCH] Backport no_vm_revert option The VM revert on test failure was added to 2.1 but it was only disabled in 2.2. --- maxscale-system-test/README.md | 1 + maxscale-system-test/testconnections.cpp | 20 +++++++++++++++++--- maxscale-system-test/testconnections.h | 6 ++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/maxscale-system-test/README.md b/maxscale-system-test/README.md index 1e332b408..6f3314a4b 100644 --- a/maxscale-system-test/README.md +++ b/maxscale-system-test/README.md @@ -65,3 +65,4 @@ System level tests for MaxScale |no_nodes_check|if yes backend checks are not executed (needed in case of RDS or similar backend)| |no_backend_log_copy|if yes logs from backend nodes are not copied (needed in case of RDS or similar backend)| |no_maxscale_start|Do not start Maxscale automatically| +|no_vm_revert|If true tests do not revert VMs after the test even if test failed| diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 73a997e77..8aee42d81 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -66,7 +66,8 @@ TestConnections::TestConnections(int argc, char *argv[]): no_backend_log_copy(false), use_snapshots(false), verbose(false), rwsplit_port(4006), readconn_master_port(4008), readconn_slave_port(4009), binlog_port(5306), global_result(0), binlog_cmd_option(0), enable_timeouts(true), use_ipv6(false), - no_galera(false) + no_galera(false), + no_vm_revert(true) { signal_set(SIGSEGV, sigfatal_handler); signal_set(SIGABRT, sigfatal_handler); @@ -303,8 +304,15 @@ TestConnections::~TestConnections() if (global_result != 0 ) { - tprintf("Reverting snapshot\n"); - revert_snapshot((char*) "clean"); + if (no_vm_revert) + { + tprintf("no_vm_revert flag is set, not reverting VMs\n"); + } + else + { + tprintf("Reverting snapshot\n"); + revert_snapshot((char*) "clean"); + } } delete repl; @@ -551,6 +559,12 @@ int TestConnections::read_env() { maxscale::start = false; } + + env = getenv("no_vm_revert"); + if ((env != NULL) && ((strcasecmp(env, "no") == 0) || (strcasecmp(env, "false") == 0) )) + { + no_vm_revert = false; + } } int TestConnections::print_env() diff --git a/maxscale-system-test/testconnections.h b/maxscale-system-test/testconnections.h index a975a93ae..6d41ec5d0 100644 --- a/maxscale-system-test/testconnections.h +++ b/maxscale-system-test/testconnections.h @@ -257,6 +257,12 @@ public: */ bool no_galera; + /** + * @brief no_vm_revert If true tests do not revert VMs after the test even if test failed + * (use it for debugging) + */ + bool no_vm_revert; + /** * @brief ssl_options string with ssl configuration for command line client */