Skip to content

Commit 9ff3a9b

Browse files
author
Madhavan
committed
Phase 5: Kafka Integration Tests & CI Workflows - Implementation
1 parent 273b813 commit 9ff3a9b

8 files changed

Lines changed: 774 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,55 @@ jobs:
8585
-PtestPulsarImage=$PULSAR_IMAGE \
8686
-PtestPulsarImageTag=$PULSAR_IMAGE_TAG \
8787
${{ matrix.module }}:test
88+
89+
test-kafka:
90+
needs: build
91+
name: Test Kafka
92+
runs-on: ubuntu-latest
93+
timeout-minutes: 360
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
module: ['agent-c4']
98+
jdk: ['11', '17']
99+
kafkaImage: ['apache/kafka:4.2.0', 'confluentinc/cp-kafka:7.9.6', 'confluentinc/cp-kafka:8.1.0']
100+
steps:
101+
- uses: actions/checkout@v6
102+
- name: Set up JDK ${{ matrix.jdk }}
103+
uses: actions/setup-java@v5
104+
with:
105+
java-version: ${{ matrix.jdk }}
106+
distribution: 'adopt'
107+
108+
- name: Get project version
109+
uses: HardNorth/github-version-generate@v1.4.0
110+
with:
111+
version-source: file
112+
version-file: gradle.properties
113+
version-file-extraction-pattern: '(?<=version=).+'
114+
115+
- name: Cache Docker layers
116+
uses: actions/cache@v5
117+
with:
118+
path: /tmp/.buildx-cache
119+
key: ${{ runner.os }}-buildx-${{ github.sha }}
120+
restore-keys: |
121+
${{ runner.os }}-buildx-
122+
123+
- name: Test with Gradle (Kafka)
124+
env:
125+
DSE_REPO_USERNAME: ${{ secrets.DSE_REPO_USERNAME }}
126+
DSE_REPO_PASSWORD: ${{ secrets.DSE_REPO_PASSWORD }}
127+
run: |
128+
set -e
129+
PREV_IFS=$IFS
130+
IFS=':'
131+
read -ra KAFKA_FULL_IMAGE <<< "${{ matrix.kafkaImage }}"
132+
IFS=$PREV_IFS
133+
KAFKA_IMAGE=${KAFKA_FULL_IMAGE[0]}
134+
KAFKA_IMAGE_TAG=${KAFKA_FULL_IMAGE[1]}
135+
136+
./gradlew -Pdse4 -PdseRepoUsername=$DSE_REPO_USERNAME -PdseRepoPassword=$DSE_REPO_PASSWORD \
137+
-PtestKafkaImage=$KAFKA_IMAGE \
138+
-PtestKafkaImageTag=$KAFKA_IMAGE_TAG \
139+
${{ matrix.module }}:test
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright DataStax, Inc 2021.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.datastax.oss.cdc.agent;
17+
18+
import com.datastax.oss.cdc.AgentTestUtil;
19+
import com.datastax.oss.cdc.KafkaSingleNodeTests;
20+
import com.datastax.testcontainers.cassandra.CassandraContainer;
21+
import lombok.extern.slf4j.Slf4j;
22+
import org.testcontainers.containers.Network;
23+
import org.testcontainers.utility.DockerImageName;
24+
25+
import java.util.Optional;
26+
27+
@Slf4j
28+
public class KafkaSingleNodeC4Tests extends KafkaSingleNodeTests {
29+
30+
public static final DockerImageName CASSANDRA_IMAGE = DockerImageName.parse(
31+
Optional.ofNullable(System.getenv("CASSANDRA_IMAGE"))
32+
.orElse("cassandra:" + System.getProperty("cassandraVersion"))
33+
).asCompatibleSubstituteFor("cassandra");
34+
35+
public KafkaSingleNodeC4Tests() {
36+
super(AgentTestUtil.Version.C4);
37+
}
38+
39+
@Override
40+
public CassandraContainer<?> createCassandraContainer(int nodeIndex, String kafkaBootstrapServers, Network testNetwork) {
41+
return CassandraContainer.createCassandraContainerWithAgentKafka(
42+
CASSANDRA_IMAGE, testNetwork, nodeIndex, "c4", kafkaBootstrapServers);
43+
}
44+
45+
@Override
46+
public int getSegmentSize() {
47+
return 1024 * 1024;
48+
}
49+
50+
}
51+
52+
// Made with Bob

0 commit comments

Comments
 (0)