From 7a0a6c3af10fa48321637b6763cfc823a82733f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 20 Jun 2018 13:37:21 +0300 Subject: [PATCH] MXS-1932: Add test case Added test case that reproduces the problem and verifies that it is fixed. --- maxscale-system-test/CMakeLists.txt | 4 +++ maxscale-system-test/mxs1932_hidden_cnf.cpp | 39 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 maxscale-system-test/mxs1932_hidden_cnf.cpp diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 1740ba870..0e91a1242 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -941,6 +941,10 @@ add_test_executable(mxs1836_show_eventTimes.cpp mxs1836_show_eventTimes mxs1836_ # https://jira.mariadb.org/browse/MXS-1889 add_test_executable(mxs1889.cpp mxs1889 mxs1889 LABELS REPL_BACKEND) +# MXS-1932: Hidden files are not ignored +# https://jira.mariadb.org/browse/MXS-1932 +add_test_executable(mxs1932_hidden_cnf.cpp mxs1932_hidden_cnf replication LABELS REPL_BACKEND) + configure_file(templates.h.in templates.h @ONLY) include(CTest) diff --git a/maxscale-system-test/mxs1932_hidden_cnf.cpp b/maxscale-system-test/mxs1932_hidden_cnf.cpp new file mode 100644 index 000000000..4816cb369 --- /dev/null +++ b/maxscale-system-test/mxs1932_hidden_cnf.cpp @@ -0,0 +1,39 @@ +/** + * MXS-1932: Hidden files are not ignored + * + * https://jira.mariadb.org/browse/MXS-1932 + */ + +#include "testconnections.h" + +#include +#include + +using namespace std; + +int main(int argc, char** argv) +{ + TestConnections::skip_maxscale_start(true); + TestConnections test(argc, argv); + + ofstream cnf("hidden.cnf"); + cnf << "[something]" << endl; + cnf << "type=turbocharger" << endl; + cnf << "target=maxscale" << endl; + cnf << "speed=maximum" << endl; + cnf.close(); + + test.maxscales->copy_to_node_legacy("hidden.cnf", "~"); + test.maxscales->ssh_node_f(0, true, + "mkdir -p /etc/maxscale.cnf.d/;" + "mv %s/hidden.cnf /etc/maxscale.cnf.d/.hidden.cnf;" + "chown -R maxscale:maxscale /etc/maxscale.cnf.d/", + test.maxscales->access_homedir[0]); + + test.assert(test.maxscales->restart_maxscale() == 0, "Starting MaxScale should suceed"); + + test.maxscales->ssh_node_f(0, true, "rm -r /etc/maxscale.cnf.d/"); + remove("hidden.cnf"); + + return test.global_result; +}