diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index dcb623a42..cce4e3546 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -988,6 +988,9 @@ add_test_executable(mxs2621_lower_case_tables.cpp mxs2621_lower_case_tables mxs2 # MXS-2631: Duplicate system tables not ignored add_test_executable(mxs2631_ignore_system_tables.cpp mxs2631_ignore_system_tables mxs2631_ignore_system_tables LABELS schemarouter BREAKS_REPL REPL_BACKEND) +# MXS-2878: Verify that TLS is required +add_test_executable(mxs2878_monitor_ssl.cpp mxs2878_monitor_ssl mxs2878_monitor_ssl LABELS REPL_BACKEND) + ############################################ # END: Normal tests # ############################################ diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs2878_monitor_ssl b/maxscale-system-test/cnf/maxscale.cnf.template.mxs2878_monitor_ssl new file mode 100644 index 000000000..e27f8da02 --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs2878_monitor_ssl @@ -0,0 +1,47 @@ +[maxscale] +threads=###threads### + +[server1] +type=server +address=###node_server_IP_1### +port=###node_server_port_1### +protocol=MySQLBackend +ssl=true + +[server2] +type=server +address=###node_server_IP_2### +port=###node_server_port_2### +protocol=MySQLBackend +ssl=true + +[server3] +type=server +address=###node_server_IP_3### +port=###node_server_port_3### +protocol=MySQLBackend +ssl=true + +[server4] +type=server +address=###node_server_IP_4### +port=###node_server_port_4### +protocol=MySQLBackend +ssl=true + +[MySQL-Monitor] +type=monitor +module=mysqlmon +servers=server1,server2,server3,server4 +user=maxskysql +password=skysql + +[CLI] +type=service +router=cli + +[CLI-Listener] +type=listener +service=CLI +protocol=maxscaled +socket=default diff --git a/maxscale-system-test/mxs2878_monitor_ssl.cpp b/maxscale-system-test/mxs2878_monitor_ssl.cpp new file mode 100644 index 000000000..a86495ae3 --- /dev/null +++ b/maxscale-system-test/mxs2878_monitor_ssl.cpp @@ -0,0 +1,35 @@ +/** + * Covers the following bugs: + * MXS-2878: Monitor connections do not insist on SSL being used + * MXS-2896: Server wrongly in Running state after failure to connect + */ + +#include "testconnections.h" +#include + +std::string join(StringSet st) +{ + std::ostringstream ss; + + for (const auto& a : st) + { + ss << a << " "; + } + + return ss.str(); +} + +int main(int argc, char** argv) +{ + TestConnections test(argc, argv); + + for (auto srv : {"server1", "server2", "server3", "server4"}) + { + StringSet expected = {"Down"}; + auto status = test.maxscales->get_server_status(srv); + test.expect(status == expected, + "Expected '%s' but got '%s'", join(expected).c_str(), join(status).c_str()); + } + + return test.global_result; +}