MXS-3915: Add test case

Extended sanity_check to cover this bug. The test reproduces the bug and
verifies that the fix works.
This commit is contained in:
Markus Mäkelä
2021-12-14 14:15:16 +02:00
parent 01dbcd8372
commit a3209bd1ca
2 changed files with 18 additions and 0 deletions

View File

@ -49,6 +49,7 @@ add_subdirectory(cdc_datatypes)
# MXS-682
# MXS-957
# MXS-1786
# MXS-3915
add_test_executable(sanity_check.cpp sanity_check replication LABELS readwritesplit LIGHT REPL_BACKEND)
# Repeatedly connect to maxscale while the backends reject all connections, expect no crash

View File

@ -99,6 +99,20 @@ void test_rwsplit(TestConnections& test)
test.maxscales->disconnect();
}
void test_mxs3915(TestConnections& test)
{
auto c = test.maxscale->rwsplit();
test.expect(c.connect(), "Failed to connect: %s", c.error());
c.query("SET autocommit=0");
c.query("COMMIT");
c.query("SET autocommit=1");
auto id = c.field("SELECT @@server_id");
test.repl->connect();
auto master_id = test.repl->get_server_id_str(0);
test.expect(id != master_id, "SELECT was routed to master after re-enabling autocommit");
}
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
@ -127,5 +141,8 @@ int main(int argc, char** argv)
// Readwritesplit sanity checks
test_rwsplit(test);
// MXS-3915: Autocommit tracking is broken
test_mxs3915(test);
return test.global_result;
}