Files
MaxScale/system-test/fwf_duplicate_rules.cpp
Esa Korhonen 08f5174915 MXS-2900 Rename maxscale-system-test directory to system-test
A link with the old directory name is provided.
2020-07-28 15:24:27 +03:00

36 lines
822 B
C++

/**
* Dbfwfilter duplicate rule test
*
* Check if duplicate rules are detected.
*/
#include "testconnections.h"
#include "fw_copy_rules.h"
const char* rules = "rule test1 deny no_where_clause\n"
"rule test1 deny columns a b c\n"
"users %@% match any rules test1\n";
int main(int argc, char** argv)
{
/** Create the rule file */
FILE* file = fopen("rules.txt", "w");
fwrite(rules, 1, strlen(rules), file);
fclose(file);
TestConnections::skip_maxscale_start(true);
TestConnections test(argc, argv);
copy_rules(&test, (char*) "rules.txt", (char*) ".");
int rc = 0;
if (test.maxscales->restart_maxscale(0) == 0)
{
test.tprintf("Restarting MaxScale succeeded when it should've failed!");
rc = 1;
}
return rc;
}