Skip to content

Commit eac8e3c

Browse files
committed
Trying to figure out the intermittent Jenkins failures.
Splitting into 2 docker-compose files to facilitate automated and manual testing.
1 parent b4bce2e commit eac8e3c

File tree

5 files changed

+270
-239
lines changed

5 files changed

+270
-239
lines changed

.copyrightconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ startyear: 2023
1111
# - Dotfiles already skipped automatically
1212
# Enable by removing the leading '# ' from the next line and editing values.
1313
# filesexcluded: third_party/*, docs/generated/*.md, assets/*.png, scripts/temp_*.py, vendor/lib.js
14-
filesexcluded: .github/*, README.md, CONTRIBUTING.md, Jenkinsfile, gradle/*, docker-compose.yml, *.gradle, gradle.properties, gradlew, gradlew.bat, **/test/resources/**, docs/**
14+
filesexcluded: .github/*, README.md, CONTRIBUTING.md, Jenkinsfile, gradle/*, docker-compose.yml, *.gradle, gradle.properties, gradlew, gradlew.bat, **/test/resources/**, docs/**, test-app/docker-compose.yml

CONTRIBUTING.md

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
This guide describes how to develop and contribute pull requests to this connector. The focus is currently on how to
2-
develop and test the connector, either via a Docker cluster install of Confluent Platform or of the regular Kafka
3-
distribution.
2+
develop and test the connector. There are two methods available - automated and manual. Both methods are performed via a
3+
Docker stack. The automated tests stack creates MarkLogic, Sonar, and Postgres instance for the automated tests. The
4+
manual tests use Confluent Platform in a different Docker stack to allow testing the connector via Confluent Control
5+
Center with a MarkLogic instance in the same stack.
46

57
### Requirements:
68
* MarkLogic Server 11+
@@ -10,7 +12,7 @@ See [the Confluent compatibility matrix](https://docs.confluent.io/platform/curr
1012
for more information. After installing your desired version of Java, ensure that the `JAVA_HOME` environment variable
1113
points to your Java installation.
1214

13-
# Configuring Local Automated and Manual Testing
15+
# Configuring Local Automated Testing
1416

1517
The test suite for the MarkLogic Kafka connector, found at `src/test`, requires that the test application first be
1618
deployed to a MarkLogic instance. The recommendation is for this application to be deployed via Docker and
@@ -19,51 +21,17 @@ deployed to a MarkLogic instance. The recommendation is for this application to
1921
Note that you do not need to install [Gradle](https://gradle.org/) - the "gradlew" program used below will install the
2022
appropriate version of Gradle if you do not have it installed already.
2123

22-
## Virtual Server Preparation
23-
The project includes a docker-compose file in the repository root that includes MarkLogic, SonarQube with a Postgres server, and Confluent
24-
Platform servers.
25-
26-
### Confluent Platform
27-
[Confluent Platform](https://docs.confluent.io/platform/current/overview.html) provides an easy mechanism for running
28-
Kafka locally via a single Docker cluster. A primary benefit of testing with Confluent Platform is to test configuring
29-
the MarkLogic Kafka connector via the
30-
[Confluent Control Center](https://docs.confluent.io/platform/current/control-center/index.html) web application.
31-
The Confluent Platform servers in this docker-compose file are based on the Confluent files and instructions at
32-
[Install a Confluent Platform cluster in Docker using a Confluent docker-compose file](https://docs.confluent.io/platform/current/platform-quickstart.html).
33-
34-
## Docker Cluster Preparation
35-
To setup the docker cluster, use the docker-compose file in the repository root to build the Docker cluster with
36-
the command:
24+
## Docker Cluster Preparation for Automated Testing
25+
The automated tests require a MarkLogic server, SonarQube server, and Postgres server. The docker-compose file in the
26+
repository root includes these services. To prepare for running the automated tests, perform the following steps:
3727
```
3828
docker-compose up -d --build
3929
```
40-
When the setup is complete, you should be able to run
41-
```
42-
docker-compose ps
43-
```
44-
and see results similar to the following.
45-
```
46-
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
47-
broker confluentinc/cp-kafka:7.6.1 "/etc/confluent/dock…" broker 14 minutes ago Up 14 minutes 0.0.0.0:9092->9092/tcp, 0.0.0.0:9101->9101/tcp
48-
connect cnfldemos/cp-server-connect-datagen:0.6.4-7.6.0 "/etc/confluent/dock…" connect 14 minutes ago Up 14 minutes 0.0.0.0:8083->8083/tcp, 9092/tcp
49-
control-center confluentinc/cp-enterprise-control-center:7.6.1 "/etc/confluent/dock…" control-center 14 minutes ago Up 14 minutes 0.0.0.0:9021->9021/tcp
50-
ksql-datagen confluentinc/ksqldb-examples:7.6.1 "bash -c 'echo Waiti…" ksql-datagen 14 minutes ago Up 14 minutes
51-
ksqldb-cli confluentinc/cp-ksqldb-cli:7.6.1 "/bin/sh" ksqldb-cli 14 minutes ago Up 14 minutes
52-
ksqldb-server confluentinc/cp-ksqldb-server:7.6.1 "/etc/confluent/dock…" ksqldb-server 14 minutes ago Up 14 minutes 0.0.0.0:8088->8088/tcp
53-
marklogic marklogicdb/marklogic-db:11.2.0-centos-1.1.2 "/tini -- /usr/local…" marklogic 14 minutes ago Up 14 minutes 25/tcp, 7997-7999/tcp, 0.0.0.0:8000-8002->8000-8002/tcp, 0.0.0.0:8010-8013->8010-8013/tcp, 8003-8009/tcp, 0.0.0.0:8018-8019->8018-8019/tcp
54-
marklogic-kafka-confluent-postgres-1 postgres:15-alpine "docker-entrypoint.s…" postgres 14 minutes ago Up 14 minutes 5432/tcp
55-
marklogic-kafka-confluent-sonarqube-1 sonarqube:10.3.0-community "/opt/sonarqube/dock…" sonarqube 14 minutes ago Up 14 minutes 0.0.0.0:9000->9000/tcp
56-
rest-proxy confluentinc/cp-kafka-rest:7.6.1 "/etc/confluent/dock…" rest-proxy 14 minutes ago Up 14 minutes 0.0.0.0:8082->8082/tcp
57-
schema-registry confluentinc/cp-schema-registry:7.6.1 "/etc/confluent/dock…" schema-registry 14 minutes ago Up 14 minutes 0.0.0.0:8081->8081/tcp
58-
```
5930

60-
You can now visit several web applications:
31+
You can now visit these web applications:
6132
* http://localhost:8000 to access the MarkLogic server.
6233
* http://localhost:9000 to use the SonarQube server as described in the "Running Sonar Code Analysis"
6334
section below.
64-
* http://localhost:9021 to access
65-
[Confluent's Control Center GUI](https://docs.confluent.io/platform/current/control-center/index.html) application.
66-
Within Control Center, click on "controlcenter.cluster" to access the configuration for the Kafka cluster.
6735

6836
## MarkLogic Preparation
6937
To prepare the MarkLogic server for automated testing as well as testing with the Confluent Platform, the Data Hub based
@@ -100,8 +68,8 @@ To configure the SonarQube service, perform the following steps:
10068
8. On the "Analysis Method" page, click on "Locally".
10169
9. In the "Provide a token" panel, click on "Generate". Copy the token.
10270
10. Click the "Continue" button.
103-
11. Update `systemProp.sonar.token=<Replace With Your Sonar Token>` in `gradle-local.properties` in the root of your
104-
project.
71+
11. Update `systemProp.sonar.token=<Replace With Your Sonar Token>` in `gradle-local.properties` in the root directory
72+
of your project.
10573

10674
To run the SonarQube analysis, run the following Gradle task in the root directory, which will run all the tests with
10775
code coverage and then generate a quality report with SonarQube:
@@ -125,16 +93,59 @@ without having to re-run the tests.
12593
For more assistance with Sonar and Gradle, see the
12694
[Sonar Gradle plugin docs](https://docs.sonarqube.org/latest/analyzing-source-code/scanners/sonarscanner-for-gradle/).
12795

96+
# Configuring Local Manual Testing
97+
This project includes a Docker Compose file that creates a Kafka cluster using Confluent Platform along with a
98+
MarkLogic server. This allows you to test the MarkLogic Kafka connector via the Confluent Control Center web
99+
application. The instructions below describe how to get started.
100+
101+
## Docker Cluster Preparation for Manual Testing
102+
The docker-compose file in the test-app directory includes these services along with a MarkLogic server.
103+
```
104+
docker-compose --env-file ./.env -f test-app/docker-compose.yml up -d --build
105+
```
106+
107+
When the setup is complete, you should be able to run
108+
```
109+
docker-compose --env-file ./.env -f test-app/docker-compose.yml ps
110+
```
111+
and see results similar to the following.
112+
```
113+
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
114+
broker confluentinc/cp-kafka:7.6.1 "/etc/confluent/dock…" broker 14 minutes ago Up 14 minutes 0.0.0.0:9092->9092/tcp, 0.0.0.0:9101->9101/tcp
115+
connect cnfldemos/cp-server-connect-datagen:0.6.4-7.6.0 "/etc/confluent/dock…" connect 14 minutes ago Up 14 minutes 0.0.0.0:8083->8083/tcp, 9092/tcp
116+
control-center confluentinc/cp-enterprise-control-center:7.6.1 "/etc/confluent/dock…" control-center 14 minutes ago Up 14 minutes 0.0.0.0:9021->9021/tcp
117+
ksql-datagen confluentinc/ksqldb-examples:7.6.1 "bash -c 'echo Waiti…" ksql-datagen 14 minutes ago Up 14 minutes
118+
ksqldb-cli confluentinc/cp-ksqldb-cli:7.6.1 "/bin/sh" ksqldb-cli 14 minutes ago Up 14 minutes
119+
ksqldb-server confluentinc/cp-ksqldb-server:7.6.1 "/etc/confluent/dock…" ksqldb-server 14 minutes ago Up 14 minutes 0.0.0.0:8088->8088/tcp
120+
marklogic marklogicdb/marklogic-db:11.2.0-centos-1.1.2 "/tini -- /usr/local…" marklogic 14 minutes ago Up 14 minutes 25/tcp, 7997-7999/tcp, 0.0.0.0:8000-8002->8000-8002/tcp, 0.0.0.0:8010-8013->8010-8013/tcp, 8003-8009/tcp, 0.0.0.0:8018-8019->8018-8019/tcp
121+
marklogic-kafka-confluent-postgres-1 postgres:15-alpine "docker-entrypoint.s…" postgres 14 minutes ago Up 14 minutes 5432/tcp
122+
marklogic-kafka-confluent-sonarqube-1 sonarqube:10.3.0-community "/opt/sonarqube/dock…" sonarqube 14 minutes ago Up 14 minutes 0.0.0.0:9000->9000/tcp
123+
rest-proxy confluentinc/cp-kafka-rest:7.6.1 "/etc/confluent/dock…" rest-proxy 14 minutes ago Up 14 minutes 0.0.0.0:8082->8082/tcp
124+
schema-registry confluentinc/cp-schema-registry:7.6.1 "/etc/confluent/dock…" schema-registry 14 minutes ago Up 14 minutes 0.0.0.0:8081->8081/tcp
125+
```
126+
127+
You can now visit several web applications:
128+
* http://localhost:8000 to access the MarkLogic server.
129+
* http://localhost:9021 to access
130+
[Confluent's Control Center GUI](https://docs.confluent.io/platform/current/control-center/index.html) application.
131+
Within Control Center, click on "controlcenter.cluster" to access the configuration for the Kafka cluster.
132+
133+
### Confluent Platform for Manual Testing
134+
[Confluent Platform](https://docs.confluent.io/platform/current/overview.html) provides an easy mechanism for running
135+
Kafka locally via a single Docker cluster. A primary benefit of testing with Confluent Platform is to test configuring
136+
the MarkLogic Kafka connector via the
137+
[Confluent Control Center](https://docs.confluent.io/platform/current/control-center/index.html) web application.
138+
The Confluent Platform servers in this docker-compose file are based on the Confluent files and instructions at
139+
[Install a Confluent Platform cluster in Docker using a Confluent docker-compose file](https://docs.confluent.io/platform/current/platform-quickstart.html).
128140

129-
## Confluent Platform for Manual Testing
130141

131142
### Building and Sharing the Connector with the Docker Container
132143
Using gradle in the root directory, build the connector archive and copy it to a directory shared with the Confluent
133144
Platform Docker cluster built in the that section, using this gradle command in the root directory:
134145
```
135146
./gradlew copyConnectorToDockerVolume
136147
```
137-
**You MUST restart the "connect" server in the Docker "confluent-platform-example" cluster.**
148+
**You MUST restart the "connect" server in the Docker "manual-tests-marklogic-kafka-confluent" cluster.**
138149

139150
Now, verify the connector has loaded properly.
140151
1. Click on "Connect" in the left sidebar.

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ def runtests(String marklogicVersion) {
99
sudo /usr/local/sbin/mladmin cleandata
1010
cd kafka-connector
1111
MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE='''+marklogicVersion+''' docker-compose up -d --build
12-
sleep 120s;
12+
sleep 60s;
1313
'''
1414
sh label:'deploy project', script: '''#!/bin/bash
1515
export JAVA_HOME=$JAVA17_HOME_DIR
1616
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
1717
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
1818
cd kafka-connector
1919
./gradlew hubInit
20+
./gradlew mlTestConnections
2021
./gradlew -i mlDeploy
2122
'''
2223
sh label:'test', script: '''#!/bin/bash

0 commit comments

Comments
 (0)