-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBZ-8015 Test offset store configuration and reconcilation
- Loading branch information
Showing
8 changed files
with
196 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
systemtests/src/test/java/io/debezium/operator/systemtests/OffsetStorageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.systemtests; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.debezium.operator.api.model.DebeziumServer; | ||
import io.debezium.operator.api.model.source.Offset; | ||
import io.debezium.operator.api.model.source.OffsetBuilder; | ||
import io.debezium.operator.systemtests.resources.NamespaceHolder; | ||
import io.debezium.operator.systemtests.resources.dmt.DmtClient; | ||
import io.debezium.operator.systemtests.resources.operator.DebeziumOperatorBundleResource; | ||
import io.debezium.operator.systemtests.resources.server.DebeziumServerGenerator; | ||
import io.debezium.operator.systemtests.resources.sinks.RedisResource; | ||
import io.fabric8.kubernetes.client.LocalPortForward; | ||
import io.skodjob.testframe.resources.KubeResourceManager; | ||
|
||
public class OffsetStorageTest extends TestBase { | ||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
|
||
@Test | ||
void testRedisOffsetStorage() { | ||
String namespace = NamespaceHolder.INSTANCE.getCurrentNamespace(); | ||
DebeziumOperatorBundleResource operatorBundleResource = new DebeziumOperatorBundleResource(); | ||
operatorBundleResource.configureAsDefault(namespace); | ||
logger.info("Deploying Operator"); | ||
operatorBundleResource.deploy(); | ||
logger.info("Deploying Debezium Server"); | ||
DebeziumServer server = DebeziumServerGenerator.generateDefaultMysqlToRedis(namespace); | ||
|
||
Offset offset = new OffsetBuilder() | ||
.withNewRedis() | ||
.withAddress(RedisResource.getDefaultRedisAddress()) | ||
.endRedis() | ||
.withFlushMs(10) | ||
.build(); | ||
server.getSpec().getSource().setOffset(offset); | ||
|
||
KubeResourceManager.getInstance().createResourceWithWait(server); | ||
assertStreamingWorks(); | ||
|
||
try (LocalPortForward lcp = dmtResource.portForward(portForwardPort, namespace)) { | ||
String redis_offset = DmtClient.readRedisOffsets(portForwardHost, portForwardPort); | ||
assertThat(redis_offset).contains("file"); | ||
assertThat(redis_offset).contains("pos"); | ||
} | ||
catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
server.getSpec().getSource().getOffset().getRedis().setKey("metadata:debezium_n:offsets"); | ||
KubeResourceManager.getInstance().createOrUpdateResourceWithWait(server); | ||
assertStreamingWorks(10, 20); | ||
|
||
try (LocalPortForward lcp = dmtResource.portForward(portForwardPort, namespace)) { | ||
String redis_offset = DmtClient.readRedisOffsets(portForwardHost, portForwardPort, "metadata:debezium_n:offsets"); | ||
assertThat(redis_offset).contains("mysql-bin."); | ||
} | ||
catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters