Skip tests that cannot be run

If a test requires Galera but it is not available, it is now skipped. All
tests that explicitly use the `test.galera` member as well as all tests
that use a Galera configuration now require that Galera is present.
This commit is contained in:
Markus Mäkelä
2018-11-16 00:10:16 +02:00
parent 11f607de8d
commit 74ec1e7400
16 changed files with 31 additions and 2 deletions

View File

@ -5,9 +5,8 @@
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
char server_id[test.galera->N][1024];
char server_id[test.repl->N][1024];
test.repl->connect();

View File

@ -14,6 +14,7 @@
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections test(argc, argv);
test.set_timeout(30);

View File

@ -163,6 +163,7 @@ int simple_failover(TestConnections* test)
int main(int argc, char** argv)
{
TestConnections::require_galera(true);
TestConnections* test = new TestConnections(argc, argv);
test->galera->verbose = false;
int rval1 = 0;

View File

@ -11,6 +11,7 @@
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections* Test = new TestConnections(argc, argv);
char sql[10240];

View File

@ -12,6 +12,7 @@
int main(int argc, char* argv[])
{
TestConnections::skip_maxscale_start(true);
TestConnections::require_galera(true);
TestConnections* Test = new TestConnections(argc, argv);
Test->maxscales->stop_maxscale(0);
Test->set_timeout(60);

View File

@ -61,6 +61,7 @@ void do_test(TestConnections& test, int master, int slave)
int main(int argc, char** argv)
{
TestConnections::require_galera(true);
TestConnections test(argc, argv);
test.galera->stop_node(2);
test.galera->stop_node(3);

View File

@ -15,6 +15,7 @@
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections test(argc, argv);
for (int i = 0; i < 2; i++)

View File

@ -410,6 +410,7 @@ int main(int argc, char* argv[])
{
mxb::Log log(MXB_LOG_TARGET_STDOUT);
TestConnections::require_galera(true);
TestConnections::skip_maxscale_start(true);
TestConnections test(argc, argv);

View File

@ -17,6 +17,7 @@
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections* Test = new TestConnections(argc, argv);
long unsigned iterations = (Test->smoke) ? 1000 : 25000;
int r = (Test->smoke) ? 1 : 3;

View File

@ -10,6 +10,7 @@ using namespace std;
int main(int argc, char** argv)
{
TestConnections::require_galera(true);
TestConnections test(argc, argv);
string query = "select 1";

View File

@ -46,6 +46,7 @@ void query_thread(TestConnections* t)
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections test(argc, argv);
int master = test.maxscales->find_master_maxadmin(test.galera);

View File

@ -58,6 +58,7 @@ void check_pers_conn(TestConnections* Test, int pers_conn_expected[], char* serv
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections* Test = new TestConnections(argc, argv);
int pers_conn_expected[4];
int galera_pers_conn_expected[4];

View File

@ -18,6 +18,7 @@
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections* Test = new TestConnections(argc, argv);
Test->set_timeout(60);

View File

@ -90,6 +90,7 @@ void test_script_monitor(TestConnections* Test, Mariadb_nodes* nodes, char* expe
int main(int argc, char* argv[])
{
TestConnections::require_galera(true);
TestConnections* Test = new TestConnections(argc, argv);
Test->set_timeout(100);

View File

@ -17,6 +17,8 @@
#include "testconnections.h"
using namespace mxb;
using std::cout;
using std::endl;
namespace maxscale
{
@ -27,6 +29,7 @@ static bool manual_debug = false;
static std::string required_repl_version;
static std::string required_galera_version;
static bool restart_galera = false;
static bool require_galera = false;
static bool multiple_maxscales = false;
}
@ -83,6 +86,11 @@ void TestConnections::require_galera_version(const char* version)
maxscale::required_galera_version = version;
}
void TestConnections::require_galera(bool value)
{
maxscale::require_galera = value;
}
void TestConnections::restart_galera(bool value)
{
maxscale::restart_galera = value;
@ -249,6 +257,12 @@ TestConnections::TestConnections(int argc, char* argv[])
test_dir);
setenv("ssl_options", ssl_options, 1);
if (no_galera && maxscale::require_galera)
{
cout << "Galera not in use, skipping test" <<endl;
exit(0);
}
repl = new Mariadb_nodes("node", test_dir, verbose);
if (!no_galera)
{

View File

@ -263,6 +263,9 @@ public:
static void require_repl_version(const char* version);
static void require_galera_version(const char* version);
/** Require that a backend is present*/
static void require_galera(bool value);
/**
* @brief Specify whether galera should be restarted.
*