Files
MaxScale/system-test/maxadmin_show_users_crash.cpp
2020-07-28 16:15:50 +03:00

31 lines
1.1 KiB
C++

/**
* @file bug673.cpp regression case for bug673 ("MaxScale crashes if "Users table data" is empty and "show
* dbusers" is executed in maxadmin")
*
* - Configure wrong IP for all backends
* - Execute maxadmin command show dbusers "RW Split Router"
* - Check MaxScale is alive by executing maxadmin again
* - Check that only new style object names in maxadmin commands are accepted
*/
#include <maxtest/testconnections.hh>
#include <maxtest/maxadmin_operations.hh>
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
test.set_timeout(60);
for (int i = 0; i < 2; i++)
{
constexpr const char* old_cmd = "maxadmin show dbusers \"RW Split Router\"|grep 'User names'";
constexpr const char* new_cmd = "maxadmin show dbusers RW-Split-Router|grep 'User names'";
test.expect(test.maxscales->ssh_node_f(0, true, old_cmd) != 0,
"Old style objects in maxadmin commands should fail");
test.expect(test.maxscales->ssh_node_f(0, true, new_cmd) == 0,
"New style objects in maxadmin commands should succeed");
}
return test.global_result;
}