-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,527 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Systemtests for Debezium Operator | ||
|
||
This module contains system tests for the Debezium Operator. | ||
Testsuite leverages tooling from [Skodjob project](https://github.com/skodjob/database-performance-hub), specifically | ||
*Test frame* and *Database Manipulation Tool*. | ||
|
||
## Current test process | ||
Testsuite creates a Kubernetes namespace for each individual class and deploys MySQL, Redis, and DMT before tests | ||
actually start. Every resource handled via the test suite should implement the `DeployableResourceGroup` interface. Communication | ||
with MySQL and Redis is executed strictly through the DMT. All API calls for DMT are implemented in | ||
[DmtClient](src/test/java/io/debezium/operator/systemtests/resources/dmt/DmtClient.java) class. | ||
|
||
## Running the tests | ||
Tests can be run and debug directly from IDE or simply via Maven. | ||
|
||
```bash | ||
mvn verify -Psystemtests -pl systemtests | ||
``` | ||
|
||
## Current state | ||
- Testing only simple deployment of Operator Bundle install |
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,206 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.debezium</groupId> | ||
<artifactId>debezium-operator</artifactId> | ||
<version>2.7.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>systemtests</artifactId> | ||
|
||
<properties> | ||
<fabric8.version>6.10.0</fabric8.version> | ||
<junit.jupiter.version>5.10.2</junit.jupiter.version> | ||
<junit.platform.launcher.version>1.10.2</junit.platform.launcher.version> | ||
<slf4j.version>2.0.11</slf4j.version> | ||
<assertj.version>3.25.3</assertj.version> | ||
<testframe.version>0.1.1</testframe.version> | ||
<dmt.version>0.0.1-alpha1</dmt.version> | ||
<okhttp.version>5.0.0-alpha.12</okhttp.version> | ||
<awaitility.version>4.2.1</awaitility.version> | ||
<jackson.version>2.16.1</jackson.version> | ||
<lombok.version>1.18.28</lombok.version> | ||
<apache.commons.lang.version>3.14.0</apache.commons.lang.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client</artifactId> | ||
<version>${fabric8.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client-api</artifactId> | ||
<version>${fabric8.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>openshift-client</artifactId> | ||
<version>${fabric8.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-launcher</artifactId> | ||
<version>${junit.platform.launcher.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>${apache.commons.lang.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.skodjob</groupId> | ||
<artifactId>test-frame-common</artifactId> | ||
<version>${testframe.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.skodjob</groupId> | ||
<artifactId>test-frame-kubernetes</artifactId> | ||
<version>${testframe.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.debezium</groupId> | ||
<artifactId>debezium-operator-api</artifactId> | ||
<version>${parent.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.skodjob</groupId> | ||
<artifactId>database-manipulation-tool-schema</artifactId> | ||
<version>${dmt.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
<version>${okhttp.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.awaitility</groupId> | ||
<artifactId>awaitility</artifactId> | ||
<version>${awaitility.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${skipITs}</skipTests> | ||
<enableAssertions>true</enableAssertions> | ||
<trimStackTrace>false</trimStackTrace> | ||
<runOrder>${runOrder}</runOrder> | ||
<!-- Idea not picking up and emitting a warning not sure why, it works in other modules just fine --> | ||
<argLine>--add-opens java.base/java.net=ALL-UNNAMED</argLine> | ||
<systemPropertyVariables> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<filtering>true</filtering> | ||
</testResource> | ||
</testResources> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>true</skipTests> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<configuration> | ||
<skipTests>true</skipTests> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>systemtests</id> | ||
<activation> | ||
<activeByDefault>false</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>systemtests</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
26 changes: 26 additions & 0 deletions
26
systemtests/src/main/java/io/debezium/operator/systemtests/ResourceUtils.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,26 @@ | ||
/* | ||
* 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 java.io.IOException; | ||
import java.net.URL; | ||
|
||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; | ||
|
||
public class ResourceUtils { | ||
public static <T> T readYaml(URL fileName, Class<T> c) { | ||
ObjectMapper mapper = new YAMLMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
|
||
try { | ||
return mapper.readValue(fileName, c); | ||
} | ||
catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
systemtests/src/test/java/io/debezium/operator/systemtests/FirstTest.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,46 @@ | ||
/* | ||
* 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 org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.debezium.operator.api.model.DebeziumServer; | ||
import io.debezium.operator.systemtests.resources.NamespaceHolder; | ||
import io.debezium.operator.systemtests.resources.operator.DebeziumOperatorBundleResource; | ||
import io.debezium.operator.systemtests.resources.server.DebeziumServerGenerator; | ||
import io.skodjob.testframe.resources.KubeResourceManager; | ||
|
||
public class FirstTest extends TestBase { | ||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
|
||
@Test | ||
void testIT() { | ||
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); | ||
KubeResourceManager.getInstance().createResourceWithWait(server); | ||
assertStreamingWorks(); | ||
} | ||
|
||
@Test | ||
void secondIT() { | ||
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); | ||
KubeResourceManager.getInstance().createResourceWithWait(server); | ||
assertStreamingWorks(); | ||
} | ||
} |
Oops, something went wrong.