Skip to content

Commit f66171f

Browse files
authored
Merge branch 'main' into connect_utils_removal
2 parents d947d30 + 32a8ba2 commit f66171f

File tree

7 files changed

+107
-19
lines changed

7 files changed

+107
-19
lines changed

.teamcity/builds/Build.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class Build(name: String, branchFilter: String, forPullRequests: Boolean) :
2626
artifacts(packaging) {
2727
artifactRules =
2828
"""
29-
+:packaging/*.jar => docker/plugins
30-
-:packaging/*-kc-oss.jar
29+
+:packages/*.jar => docker/plugins
30+
-:packages/*-kc-oss.jar
3131
"""
3232
.trimIndent()
3333
}

.teamcity/builds/Common.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import jetbrains.buildServer.configs.kotlin.buildFeatures.pullRequests
1313

1414
const val GITHUB_OWNER = "neo4j"
1515
const val GITHUB_REPOSITORY = "neo4j-kafka-connector"
16+
const val MAVEN_DEFAULT_ARGS =
17+
"--no-transfer-progress --batch-mode -Dmaven.repo.local=%teamcity.build.checkoutDir%/.m2"
1618

1719
enum class LinuxSize(val value: String) {
1820
SMALL("small"),

.teamcity/builds/IntegrationTests.kt

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package builds
22

33
import jetbrains.buildServer.configs.kotlin.BuildStep
4-
import jetbrains.buildServer.configs.kotlin.BuildStepConditions
54
import jetbrains.buildServer.configs.kotlin.BuildType
5+
import jetbrains.buildServer.configs.kotlin.buildFeatures.buildCache
66
import jetbrains.buildServer.configs.kotlin.buildFeatures.dockerSupport
77
import jetbrains.buildServer.configs.kotlin.buildSteps.MavenBuildStep
88
import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep
@@ -34,23 +34,36 @@ class IntegrationTests(id: String, name: String, init: BuildType.() -> Unit) :
3434
</settings>
3535
*/
3636

37-
artifactRules = "packaging/neo4j-kafka-connect-neo4j-*-SNAPSHOT.jar => docker/plugins"
3837
params {
3938
text("env.PACKAGES_USERNAME", "%github-packages-user%")
4039
password("env.PACKAGES_PASSWORD", "%github-packages-token%")
40+
41+
text("env.BROKER_EXTERNAL_HOST", "broker:29092")
42+
text("env.SCHEMA_CONTROL_REGISTRY_URI", "http://schema-registry:8081")
43+
text("env.SCHEMA_CONTROL_REGISTRY_EXTERNAL_URI", "http://schema-registry:8081")
44+
text("env.KAFKA_CONNECT_EXTERNAL_URI", "http://connect:8083")
45+
text("env.NEO4J_URI", "neo4j://neo4j")
46+
text("env.NEO4J_EXTERNAL_URI", "neo4j://neo4j")
47+
text("env.NEO4J_USER", "neo4j")
48+
text("env.NEO4J_PASSWORD", "password")
4149
}
4250

4351
steps {
4452
script {
45-
scriptContent = """
53+
scriptContent =
54+
"""
4655
#!/bin/bash -eu
4756
# TODO: publish custom image instead
4857
apt-get update
4958
apt-get install --yes ruby-full
5059
gem install dip
5160
curl -fsSL https://get.docker.com | sh
5261
dip compose up -d neo4j zookeeper broker schema-registry control-center
53-
""".trimIndent()
62+
until [ "`docker inspect -f {{.State.Health.Status}} control-center`"=="healthy" ]; do
63+
sleep 0.1;
64+
done;
65+
"""
66+
.trimIndent()
5467
formatStderrAsError = true
5568

5669
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
@@ -59,25 +72,30 @@ class IntegrationTests(id: String, name: String, init: BuildType.() -> Unit) :
5972
}
6073
maven {
6174
this.goals = "verify"
62-
this.runnerArgs = "-DskipUnitTests"
75+
this.runnerArgs = "$MAVEN_DEFAULT_ARGS -DskipUnitTests"
6376

6477
// this is the settings name we uploaded to Connectors project
6578
userSettingsSelection = "github"
79+
localRepoScope = MavenBuildStep.RepositoryScope.MAVEN_DEFAULT
6680

6781
dockerImagePlatform = MavenBuildStep.ImagePlatform.Linux
6882
dockerImage = "eclipse-temurin:11-jdk"
69-
dockerRunParameters = "--volume /var/run/docker.sock:/var/run/docker.sock"
83+
dockerRunParameters =
84+
"--volume /var/run/docker.sock:/var/run/docker.sock --network neo4j-kafka-connector_default"
7085
}
7186
script {
72-
scriptContent = """
87+
scriptContent =
88+
"""
7389
#!/bin/bash -eu
7490
# TODO: publish custom image instead
7591
apt-get update
7692
apt-get install --yes ruby-full
7793
gem install dip
7894
curl -fsSL https://get.docker.com | sh
95+
dip compose logs --no-color
7996
dip compose down --rmi local
80-
""".trimIndent()
97+
"""
98+
.trimIndent()
8199
formatStderrAsError = true
82100

83101
executionMode = BuildStep.ExecutionMode.ALWAYS
@@ -87,8 +105,17 @@ class IntegrationTests(id: String, name: String, init: BuildType.() -> Unit) :
87105
}
88106
}
89107

90-
features { dockerSupport {} }
108+
features {
109+
dockerSupport {}
91110

92-
requirements { runOnLinux(LinuxSize.LARGE) }
111+
buildCache {
112+
this.name = "neo4j-kafka-connector"
113+
publish = true
114+
use = true
115+
publishOnlyChanged = true
116+
rules = ".m2/repository"
117+
}
118+
}
93119

120+
requirements { runOnLinux(LinuxSize.LARGE) }
94121
})

.teamcity/builds/Maven.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package builds
22

33
import jetbrains.buildServer.configs.kotlin.BuildType
4+
import jetbrains.buildServer.configs.kotlin.buildFeatures.buildCache
45
import jetbrains.buildServer.configs.kotlin.buildFeatures.dockerSupport
56
import jetbrains.buildServer.configs.kotlin.buildSteps.MavenBuildStep
67
import jetbrains.buildServer.configs.kotlin.buildSteps.maven
@@ -37,18 +38,29 @@ class Maven(id: String, name: String, goals: String, args: String? = null) :
3738
steps {
3839
maven {
3940
this.goals = goals
40-
this.runnerArgs = args
41+
this.runnerArgs = "$MAVEN_DEFAULT_ARGS ${args ?: ""}"
4142

4243
// this is the settings name we uploaded to Connectors project
4344
userSettingsSelection = "github"
45+
localRepoScope = MavenBuildStep.RepositoryScope.MAVEN_DEFAULT
4446

4547
dockerImagePlatform = MavenBuildStep.ImagePlatform.Linux
4648
dockerImage = "eclipse-temurin:11-jdk"
4749
dockerRunParameters = "--volume /var/run/docker.sock:/var/run/docker.sock"
4850
}
4951
}
5052

51-
features { dockerSupport {} }
53+
features {
54+
dockerSupport {}
55+
56+
buildCache {
57+
this.name = "neo4j-kafka-connector"
58+
publish = true
59+
use = true
60+
publishOnlyChanged = true
61+
rules = ".m2/repository"
62+
}
63+
}
5264

5365
requirements { runOnLinux(LinuxSize.SMALL) }
5466
})

dip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interaction:
2323
description: verify connector packages
2424
runner: local
2525
command: >
26-
sh -c "./mvnw verify"
26+
sh -c "./mvnw verify -DskipUnitTests"
2727
environment:
2828
BROKER_EXTERNAL_HOST: "localhost:9092"
2929
SCHEMA_CONTROL_REGISTRY_URI: "http://schema-registry:8081"

docker/docker-compose.yml

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ services:
1212
NEO4J_ACCEPT_LICENSE_AGREEMENT: "yes"
1313
NEO4J_server_memory_heap_max__size: "4G"
1414
NEO4J_internal_dbms_change__data__capture: "true"
15+
healthcheck:
16+
test: [ "CMD", "cypher-shell", "-u", "neo4j", "-p", "password", "RETURN 1" ]
17+
start_period: 2m
18+
start_interval: 10s
19+
interval: 30s
20+
timeout: 10s
21+
retries: 5
1522

1623
zookeeper:
1724
image: confluentinc/cp-zookeeper:7.5.0
@@ -22,6 +29,13 @@ services:
2229
environment:
2330
ZOOKEEPER_CLIENT_PORT: 2181
2431
ZOOKEEPER_TICK_TIME: 2000
32+
healthcheck:
33+
test: [ "CMD", "nc", "-z", "localhost", "2181" ]
34+
start_period: 5m
35+
start_interval: 10s
36+
interval: 1m
37+
timeout: 10s
38+
retries: 5
2539

2640
broker:
2741
image: confluentinc/cp-server:7.5.0
@@ -51,6 +65,13 @@ services:
5165
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
5266
CONFLUENT_METRICS_ENABLE: 'true'
5367
CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
68+
healthcheck:
69+
test: [ "CMD", "nc", "-z", "localhost", "9092" ]
70+
start_period: 5m
71+
start_interval: 10s
72+
interval: 1m
73+
timeout: 10s
74+
retries: 5
5475

5576
schema-registry:
5677
image: confluentinc/cp-schema-registry:7.5.0
@@ -64,6 +85,13 @@ services:
6485
SCHEMA_REGISTRY_HOST_NAME: schema-registry
6586
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'broker:29092'
6687
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
88+
healthcheck:
89+
test: [ "CMD", "nc", "-z", "localhost", "8081" ]
90+
start_period: 5m
91+
start_interval: 10s
92+
interval: 1m
93+
timeout: 10s
94+
retries: 5
6795

6896
connect:
6997
image: confluentinc/cp-server-connect:7.5.0
@@ -101,15 +129,27 @@ services:
101129
- -c
102130
- |
103131
/etc/confluent/docker/run
132+
healthcheck:
133+
test: [ "CMD", "nc", "-z", "localhost", "8083" ]
134+
start_period: 5m
135+
start_interval: 10s
136+
interval: 1m
137+
timeout: 10s
138+
retries: 5
104139

105140
control-center:
106141
image: confluentinc/cp-enterprise-control-center:7.5.0
107142
hostname: control-center
108143
container_name: control-center
109144
depends_on:
110-
- broker
111-
- schema-registry
112-
- connect
145+
broker:
146+
condition: service_healthy
147+
schema-registry:
148+
condition: service_healthy
149+
connect:
150+
condition: service_healthy
151+
neo4j: # not required but makes it easier to make sure everything is started
152+
condition: service_healthy
113153
ports:
114154
- "9021:9021"
115155
environment:
@@ -121,3 +161,10 @@ services:
121161
CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1
122162
CONFLUENT_METRICS_TOPIC_REPLICATION: 1
123163
PORT: 9021
164+
healthcheck:
165+
test: [ "CMD", "curl", "-f", "http://localhost:9021" ]
166+
start_period: 5m
167+
start_interval: 10s
168+
interval: 1m
169+
timeout: 10s
170+
retries: 5

source/src/test/kotlin/org/neo4j/connectors/kafka/source/Neo4jSourceIT.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Neo4jSourceIT {
3737
streamingFrom = StreamingFrom.ALL,
3838
streamingQuery =
3939
"MATCH (ts:TestSource) WHERE ts.timestamp > \$lastCheck RETURN ts.name AS name, ts.surname AS surname, ts.timestamp AS timestamp, ts.execId AS execId",
40-
consumerOffset = "latest",
40+
consumerOffset = "earliest",
4141
)
4242
@Test
4343
fun `reads latest changes from Neo4j source`(

0 commit comments

Comments
 (0)