DBZ-2913 Fix GTID-based tests with no GTID enabled for MariaDB
This commit is contained in:
parent
ffe1824772
commit
15ca23bff8
@ -31,8 +31,9 @@ public Statement apply(Statement base, Description description) {
|
||||
|
||||
public static SkipWhenGtidModeIs.GtidMode getGtidMode() {
|
||||
try (MySqlTestConnection db = MySqlTestConnection.forTestDatabase("emptydb")) {
|
||||
String databaseOption = MySqlTestConnection.isMariaDB() ? "GTID_STRICT_MODE" : "GTID_MODE";
|
||||
return db.queryAndMap(
|
||||
"SHOW GLOBAL VARIABLES LIKE 'GTID_MODE'",
|
||||
"SHOW GLOBAL VARIABLES LIKE '" + databaseOption + "'",
|
||||
rs -> {
|
||||
if (rs.next()) {
|
||||
return SkipWhenGtidModeIs.GtidMode.valueOf(rs.getString(2));
|
||||
|
@ -19,7 +19,9 @@
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import io.debezium.config.Configuration;
|
||||
import io.debezium.connector.mysql.MySqlConnector;
|
||||
@ -27,6 +29,8 @@
|
||||
import io.debezium.connector.mysql.MySqlConnectorConfig.SnapshotMode;
|
||||
import io.debezium.connector.mysql.MySqlTestConnection;
|
||||
import io.debezium.connector.mysql.UniqueDatabase;
|
||||
import io.debezium.connector.mysql.junit.SkipTestDependingOnGtidModeRule;
|
||||
import io.debezium.connector.mysql.junit.SkipWhenGtidModeIs;
|
||||
import io.debezium.doc.FixFor;
|
||||
import io.debezium.embedded.AbstractConnectorTest;
|
||||
import io.debezium.jdbc.JdbcConnection;
|
||||
@ -39,6 +43,7 @@
|
||||
* @author Jiri Pechanec
|
||||
*/
|
||||
@SkipWhenDatabaseVersion(check = LESS_THAN, major = 5, minor = 6, reason = "DDL uses fractional second data types, not supported until MySQL 5.6")
|
||||
@SkipWhenGtidModeIs(value = SkipWhenGtidModeIs.GtidMode.OFF)
|
||||
public class ZZZGtidSetIT extends AbstractConnectorTest {
|
||||
|
||||
private static final Path SCHEMA_HISTORY_PATH = Testing.Files.createTestingPath("file-schema-history-connect.txt").toAbsolutePath();
|
||||
@ -49,6 +54,9 @@ public class ZZZGtidSetIT extends AbstractConnectorTest {
|
||||
|
||||
private Configuration config;
|
||||
|
||||
@Rule
|
||||
public TestRule skipTest = new SkipTestDependingOnGtidModeRule();
|
||||
|
||||
@Before
|
||||
public void beforeEach() {
|
||||
stopConnector();
|
||||
@ -86,11 +94,6 @@ private boolean isGtidModeEnabled() throws SQLException {
|
||||
public void shouldProcessPurgedGtidSet() throws SQLException, InterruptedException {
|
||||
Testing.Files.delete(SCHEMA_HISTORY_PATH);
|
||||
|
||||
if (!isGtidModeEnabled()) {
|
||||
logger.warn("GTID is not enabled, skipping shouldProcessPurgedGtidSet");
|
||||
return;
|
||||
}
|
||||
|
||||
purgeDatabaseLogs();
|
||||
final UniqueDatabase database = new UniqueDatabase("myServer1", "connector_test")
|
||||
.withDbHistoryPath(SCHEMA_HISTORY_PATH);
|
||||
@ -175,11 +178,6 @@ private List<String> getBinlogs(JdbcConnection connection) throws SQLException {
|
||||
public void shouldProcessPurgedLogsWhenDownAndSnapshotNeeded() throws SQLException, InterruptedException {
|
||||
Testing.Files.delete(SCHEMA_HISTORY_PATH);
|
||||
|
||||
if (!isGtidModeEnabled()) {
|
||||
logger.warn("GTID is not enabled, skipping shouldProcessPurgedLogsWhenDownAndSnapshotNeeded");
|
||||
return;
|
||||
}
|
||||
|
||||
purgeDatabaseLogs();
|
||||
final UniqueDatabase database = new UniqueDatabase("myServer1", "connector_test")
|
||||
.withDbHistoryPath(SCHEMA_HISTORY_PATH);
|
||||
|
Loading…
Reference in New Issue
Block a user