diff --git a/system-test/kerberos_setup.cpp b/system-test/kerberos_setup.cpp index 64b12bd25..35bc1e7c7 100644 --- a/system-test/kerberos_setup.cpp +++ b/system-test/kerberos_setup.cpp @@ -9,6 +9,15 @@ #include #include "testconnections.h" +int install_kerberos(std::string machine_name, std::string maria_version) +{ + int res = system((std::string("mdbci install_product --product kerberos_server ") + machine_name).c_str()); + // Ignoring exit code becase in some versions of MariaDB gssapi is included into client/server + system((std::string("mdbci install_product --product plugin_gssapi_client --product-version ") + maria_version + " " + machine_name).c_str()); + system((std::string("mdbci install_product --product plugin_gssapi_server --product-version ") + maria_version + " " + machine_name).c_str()); + return res; +} + int main(int argc, char* argv[]) { TestConnections* Test = new TestConnections(argc, argv); @@ -36,14 +45,8 @@ int main(int argc, char* argv[]) sprintf(str, "%s/krb5.conf", test_dir); for (i = 0; i < Test->repl->N; i++) { - Test->repl->ssh_node(i, - (char*) - "yum clean all", - true); - Test->repl->ssh_node(i, - (char*) - "yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-workstation pam_krb5", - true); + install_kerberos(Test->get_mdbci_config_name() + "/" + Test->repl->mdbci_node_name(i), get_str_version(std::string(Test->repl->version[i]))); + Test->repl->copy_to_node_legacy(str, Test->repl->access_homedir[i], i); sprintf(str1, "cp %s/krb5.conf /etc/", Test->repl->access_homedir[i]); Test->repl->ssh_node(i, str1, true); @@ -62,18 +65,9 @@ int main(int argc, char* argv[]) Test->maxscales->ssh_node_f(0, true, (char*) "cp %s/krb5.conf /etc/", Test->maxscales->access_homedir[0]); Test->tprintf("Instaling Kerberos server packages to Maxscale node\n"); - Test->maxscales->ssh_node(0, (char*) "yum clean all", true); - Test->maxscales->ssh_node(0, (char*) "yum install rng-tools -y", true); - Test->maxscales->ssh_node(0, (char*) "rngd -r /dev/urandom -o /dev/random", true); - Test->maxscales->ssh_node(0, - (char*) - "yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", - true); + install_kerberos(Test->get_mdbci_config_name() + "/" + Test->maxscales->mdbci_node_name(0), get_str_version(std::string(Test->repl->version[0]))); - Test->maxscales->ssh_node_f(0, - true, - (char*) - "yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5"); + Test->maxscales->ssh_node(0, (char*) "rngd -r /dev/urandom -o /dev/random", true); Test->tprintf("Configuring Kerberos server\n"); Test->maxscales->ssh_node(0, diff --git a/system-test/maxtest/include/maxtest/mariadb_func.h b/system-test/maxtest/include/maxtest/mariadb_func.h index 428ac0373..acb923537 100644 --- a/system-test/maxtest/include/maxtest/mariadb_func.h +++ b/system-test/maxtest/include/maxtest/mariadb_func.h @@ -253,6 +253,13 @@ Result get_result(MYSQL* conn, std::string sql); int get_int_version(std::string version); +/** + * @brief get_str_version Extract version number from full version string + * @param version + * @return MariaDB version in xx.xx.xx format + */ +std::string get_str_version(std::string version); + // Helper class for performing queries class Connection { diff --git a/system-test/maxtest/include/maxtest/nodes.hh b/system-test/maxtest/include/maxtest/nodes.hh index f2c767d5a..67d02318e 100644 --- a/system-test/maxtest/include/maxtest/nodes.hh +++ b/system-test/maxtest/include/maxtest/nodes.hh @@ -101,10 +101,17 @@ public: */ const char* ip(int i = 0) const; + /** + * @brief mdbci_node_name + * @param node + * @return name of the node in MDBCI format + */ + std::string mdbci_node_name(int node); + /** * @brief Generate command line to execute command on the node via ssh * @param cmd result - * @param index index number of the node (index) + * @param node number of the node (index) * @param ssh command to execute * @param sudo if true the command is executed with root privelegues */ @@ -112,7 +119,7 @@ public: /** * @brief executes shell command on the node using ssh - * @param index number of the node (index) + * @param node number of the node (index) * @param ssh command to execute * @param sudo if true the command is executed with root privelegues * @param pointer to variable to store process exit code diff --git a/system-test/maxtest/include/maxtest/testconnections.h b/system-test/maxtest/include/maxtest/testconnections.h index 4a2461baf..5b71a073c 100644 --- a/system-test/maxtest/include/maxtest/testconnections.h +++ b/system-test/maxtest/include/maxtest/testconnections.h @@ -548,6 +548,8 @@ public: */ int reinstall_maxscales(); + std::string get_mdbci_config_name() {return m_mdbci_config_name;} + private: void report_result(const char* format, va_list argp); void copy_one_mariadb_log(Mariadb_nodes* nrepl, int i, std::string filename); diff --git a/system-test/maxtest/src/mariadb_func.cc b/system-test/maxtest/src/mariadb_func.cc index da136d7b4..9a9b3dfd8 100644 --- a/system-test/maxtest/src/mariadb_func.cc +++ b/system-test/maxtest/src/mariadb_func.cc @@ -596,6 +596,15 @@ int get_int_version(std::string version) return major * 10000 + minor * 100 + patch; } +std::string get_str_version(std::string version) +{ + + std::string str_version; + int i = version.find('-'); + if (i > 0) return version.substr(0, i); + return version; +} + bool Connection::connect() { mysql_close(m_conn); diff --git a/system-test/maxtest/src/nodes.cc b/system-test/maxtest/src/nodes.cc index 8f3bc40d0..5177831a5 100644 --- a/system-test/maxtest/src/nodes.cc +++ b/system-test/maxtest/src/nodes.cc @@ -396,6 +396,11 @@ const char* Nodes::ip(int i) const return use_ipv6 ? IP6[i] : IP[i]; } +std::string Nodes::mdbci_node_name(int node) +{ + return(string_printf("%s_%03d", prefix, node)); +} + std::string Nodes::get_nc_item(const char* item_name) { size_t start = network_config.find(item_name);