MXS-2900 maxtest header cleanup

This commit is contained in:
Esa Korhonen 2020-04-11 21:55:35 +03:00
parent 03726a5f25
commit f549d95793
25 changed files with 47 additions and 141 deletions

View File

@ -7,7 +7,7 @@
#include "testconnections.h"
#include "big_transaction.h"
#include "sql_t1.h"
typedef void * FUNC(void * ptr);

View File

@ -1,8 +1,6 @@
#pragma once
#include "testconnections.h"
#include "sql_t1.h"
#include "get_com_select_insert.h"
class TestConnections;
// pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
typedef struct

View File

@ -1,14 +0,0 @@
#pragma once
#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>
#include "sql_t1.h"
/**
* @brief big_transaction Executes big transaction (includes N INSERTs of 10000 rows)
* @param conn MYSQL connection handler
* @param N Number of INSERTs
* @return 0 if success
*/
int big_transaction(MYSQL* conn, int N);

View File

@ -1,7 +1,5 @@
#pragma once
#include <iostream>
#include <unistd.h>
#include "testconnections.h"
/**

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2018 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2024-03-10
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#pragma once
#include <string>
namespace base
{
/* Environment variable. Usage:
* Env user{"USER"};
* std::string home = Env{"HOME"};
* An environment variable can be empty() but
* still is_defined().
*/
class Env : public std::string
{
public:
Env(const std::string& name) : m_is_defined(false)
{
if (const char* var = getenv(name.c_str()))
{
m_is_defined = true;
this->assign(var);
}
}
bool is_defined() const
{
return m_is_defined;
}
private:
bool m_is_defined;
};
} // base

View File

@ -1,10 +1,5 @@
#pragma once
#include <iostream>
#include <unistd.h>
using namespace std;
/**
* @brief execute_cmd Execute shell command
* @param cmd Command line

View File

@ -1,6 +1,6 @@
#pragma once
#include "testconnections.h"
class TestConnections;
/**
* @brief copy_rules Copy rules file for firewall filter to Maxscale machine

View File

@ -1,6 +1,6 @@
#pragma once
#include "testconnections.h"
class Mariadb_nodes;
/**
* @brief get_global_status_allnodes Reads COM_SELECT and COM_INSERT variables from all nodes and stores into

View File

@ -1,6 +1,6 @@
#pragma once
#include "testconnections.h"
class TestConnections;
#define FAILOVER_WAIT_TIME 20

View File

@ -1,5 +1,7 @@
#pragma once
class TestConnections;
int create_tcp_socket();
char* get_ip(char* host);
char* build_get_query(char* host, const char* page);

View File

@ -5,11 +5,6 @@
#include "mariadb_func.h"
#include "mariadb_nodes.h"
#define DEFAULT_MAXSCALE_CNF "/etc/maxscale.cnf"
#define DEFAULT_MAXSCALE_LOG_DIR "/var/log/maxscale/"
#define DEFAULT_MAXSCALE_BINLOG_DIR "/var/lib/maxscale/Binlog_Service/"
#define DEFAULT_MAXADMIN_PASSWORD "mariadb"
class Maxscales: public Nodes
{
public:

View File

@ -2,11 +2,11 @@
#include <errno.h>
#include <string>
#include "mariadb_func.h"
#include <set>
#include <string>
#include <maxbase/ccdefs.hh>
#include "mariadb_func.h"
typedef std::set<std::string> StringSet;

View File

@ -2,10 +2,8 @@
#include <iostream>
#include <unistd.h>
#include "testconnections.h"
#include <jansson.h>
using namespace std;
#include "testconnections.h"
class RDS
{

View File

@ -1,25 +0,0 @@
#ifndef SQL_CONST_H
#define SQL_CONST_H
const char* create_repl_user =
"grant replication slave on *.* to repl@'%%' identified by 'repl'; "
"FLUSH PRIVILEGES";
const char* setup_slave =
"change master to MASTER_HOST='%s', "
"MASTER_USER='repl', "
"MASTER_PASSWORD='repl', "
"MASTER_LOG_FILE='%s', "
"MASTER_LOG_POS=%s, "
"MASTER_PORT=%d; "
"start slave;";
const char* setup_slave_no_pos =
"change master to MASTER_HOST='%s', "
"MASTER_USER='repl', "
"MASTER_PASSWORD='repl', "
"MASTER_LOG_FILE='mar-bin.000001', "
"MASTER_LOG_POS=4, "
"MASTER_PORT=%d";
#endif // SQL_CONST_H

View File

@ -1,7 +1,6 @@
#pragma once
#include "mariadb_func.h"
#include "testconnections.h"
#include <mysql.h>
/**
* @brief execute_select_query_and_check Execute query and check that result contains expected number of rows

View File

@ -1,9 +1,6 @@
#pragma once
#include <iostream>
#include "testconnections.h"
#include "maxadmin_operations.h"
#include "sql_t1.h"
class TestConnections;
/**
* @brief check_sha1 Check that checksum of binlog files on Maxscale machines and all backends are equal

View File

@ -1,6 +1,5 @@
add_library(maxtest SHARED
big_load.cc
big_transaction.cc
blob_test.cc
config_operations.cc
different_size.cc

View File

@ -1,5 +1,10 @@
#include "big_load.h"
#include <pthread.h>
#include "testconnections.h"
#include "sql_t1.h"
#include "get_com_select_insert.h"
void load(long int* new_inserts,
long int* new_selects,

View File

@ -1,23 +0,0 @@
#include "big_transaction.h"
int big_transaction(MYSQL* conn, int N)
{
int local_result = 0;
char sql[1000000];
local_result += create_t1(conn);
local_result += execute_query(conn, (char*) "START TRANSACTION");
local_result += execute_query(conn, (char*) "SET autocommit = 0");
for (int i = 0; i < N; i++)
{
create_insert_string(sql, 10000, i);
local_result += execute_query(conn, "%s", sql);
local_result += execute_query(conn, "CREATE TABLE t2(id int);");
local_result += execute_query(conn, "%s", sql);
local_result += execute_query(conn, "DROP TABLE t2;");
local_result += execute_query(conn, "%s", sql);
}
local_result += execute_query(conn, (char*) "COMMIT");
return local_result;
}

View File

@ -1,5 +1,6 @@
#include "fw_copy_rules.h"
#include <sstream>
#include "testconnections.h"
void copy_rules(TestConnections* Test, const char* rules_name, const char* rules_dir)
{

View File

@ -1,4 +1,4 @@
#include "testconnections.h"
#include "mariadb_nodes.h"
/**
* Reads COM_SELECT and COM_INSERT variables from all nodes and stores into 'selects' and 'inserts'

View File

@ -1,5 +1,6 @@
#include "keepalived_func.h"
#include "get_my_ip.h"
#include "testconnections.h"
char* print_version_string(TestConnections* Test)
{

View File

@ -11,7 +11,6 @@
*/
#include "mariadb_nodes.h"
#include "sql_const.h"
#include <climits>
#include <string>
#include <sstream>
@ -28,6 +27,27 @@ using std::endl;
namespace
{
static bool g_require_gtid = false;
const char setup_slave_no_pos[] =
"change master to MASTER_HOST='%s', "
"MASTER_USER='repl', "
"MASTER_PASSWORD='repl', "
"MASTER_LOG_FILE='mar-bin.000001', "
"MASTER_LOG_POS=4, "
"MASTER_PORT=%d";
const char setup_slave[] =
"change master to MASTER_HOST='%s', "
"MASTER_USER='repl', "
"MASTER_PASSWORD='repl', "
"MASTER_LOG_FILE='%s', "
"MASTER_LOG_POS=%s, "
"MASTER_PORT=%d; "
"start slave;";
const char create_repl_user[] =
"grant replication slave on *.* to repl@'%%' identified by 'repl'; "
"FLUSH PRIVILEGES";
}
void Mariadb_nodes::require_gtid(bool value)

View File

@ -1,9 +1,12 @@
#include "maxscales.hh"
#include <sstream>
#include <unordered_map>
#include <string>
#include "envv.hh"
#define DEFAULT_MAXSCALE_CNF "/etc/maxscale.cnf"
#define DEFAULT_MAXSCALE_LOG_DIR "/var/log/maxscale/"
#define DEFAULT_MAXSCALE_BINLOG_DIR "/var/lib/maxscale/Binlog_Service/"
#define DEFAULT_MAXADMIN_PASSWORD "mariadb"
Maxscales::Maxscales(const char *pref, const char *test_cwd, bool verbose,
std::string network_config)
{

View File

@ -1,6 +1,8 @@
#include "sql_t1.h"
#include <cstdio>
#include <pthread.h>
#include "mariadb_func.h"
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static char** sql = NULL;