Add configuration reset command

Resetting the settings makes it possible to start a test from a known good
configuration.
This commit is contained in:
Markus Mäkelä
2018-02-01 11:05:38 +02:00
parent 8c8aaeae8e
commit 0d037b2c24
2 changed files with 31 additions and 0 deletions

View File

@ -1324,6 +1324,25 @@ void Mariadb_nodes::add_server_setting(int node, const char* setting)
ssh_node_f(node, true, "sudo sed -i '$a %s' /etc/my.cnf.d/server.cnf", setting); ssh_node_f(node, true, "sudo sed -i '$a %s' /etc/my.cnf.d/server.cnf", setting);
} }
void Mariadb_nodes::reset_server_settings(int node)
{
std::stringstream ss;
ss << test_dir << "/mdbci/cnf/server" << node + 1 << ".cnf";
// Note: This is a CentOS specific path
ssh_node(node, "sudo rm -rf /etc/my.cnf.d/*", true);
copy_to_node(node, ss.str().c_str(), "~/");
ssh_node_f(node, false, "sudo mv ~/server%d.cnf /etc/my.cnf.d/", node + 1);
}
void Mariadb_nodes::reset_server_settings()
{
for (int i = 0; i < N; i++)
{
reset_server_settings(i);
}
}
/** /**
* @brief extract_version_from_string Tries to find MariaDB server version number in the output of 'mysqld --version' * @brief extract_version_from_string Tries to find MariaDB server version number in the output of 'mysqld --version'
* Function does not allocate any memory * Function does not allocate any memory

View File

@ -396,6 +396,18 @@ public:
*/ */
void add_server_setting(int node, const char* setting); void add_server_setting(int node, const char* setting);
/**
* Restore the original configuration for this server
*
* @param node Node to restore
*/
void reset_server_settings(int node);
/**
* Restore the original configuration for all servers
*/
void reset_server_settings();
/** /**
* @brief revert_nodes_snapshot Execute MDBCI snapshot revert command for all nodes * @brief revert_nodes_snapshot Execute MDBCI snapshot revert command for all nodes
* @return true in case of success * @return true in case of success