-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CassandraDependenciesDockerJobTest to verify container-based dock…
…er job execution (#150) * Add CassandraDependenciesDockerJobTest to verify container-based docker job execution Signed-off-by: Vladimir Sitnikov <[email protected]> * Keep classes from Cassandra Java Driver This resolves Caused by: java.lang.IllegalArgumentException: Can't find class DefaultMetricsFactory (specified by advanced.metrics.factory.class) at com.datastax.oss.driver.internal.core.util.Reflection.resolveClass(Reflection.java:302) at com.datastax.oss.driver.internal.core.util.Reflection.buildFromConfig(Reflection.java:235) at com.datastax.oss.driver.internal.core.util.Reflection.buildFromConfig(Reflection.java:110) at com.datastax.oss.driver.internal.core.context.DefaultDriverContext.buildMetricsFactory(DefaultDriverContext.java:548) Signed-off-by: Vladimir Sitnikov <[email protected]> * Skip Elasticsearch in Cassandra CI job Signed-off-by: Vladimir Sitnikov <[email protected]> * Group cassandra dependencies job logs in GitHub output Signed-off-by: Vladimir Sitnikov <[email protected]> --------- Signed-off-by: Vladimir Sitnikov <[email protected]>
- Loading branch information
Showing
7 changed files
with
143 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,18 @@ jobs: | |
# TODO remove once testcontainers are updated | ||
- name: pull ryuk image | ||
run: docker pull testcontainersofficial/ryuk:0.3.0 | ||
- name: Build docker image | ||
uses: docker/[email protected] | ||
# We need the image for the tests | ||
with: | ||
context: . | ||
push: false | ||
tags: ghcr.io/jaegertracing/spark-dependencies/spark-dependencies | ||
- name: compile | ||
run: ./mvnw --batch-mode clean install -DskipTests | ||
- name: test | ||
# pin Jaeger version temporarily to work around build failures | ||
run: JAEGER_VERSION=1.52.0 ./mvnw --batch-mode clean test | ||
run: JAEGER_VERSION=1.52.0 ./mvnw --batch-mode test -pl jaeger-spark-dependencies-cassandra | ||
|
||
latest-jaeger-es7: | ||
name: Latest Jaeger and ES7 | ||
|
@@ -38,7 +47,7 @@ jobs: | |
- name: compile | ||
run: ./mvnw --batch-mode clean install -DskipTests | ||
- name: test | ||
run: ELASTICSEARCH_VERSION=7.3.0 ./mvnw --batch-mode clean test -pl jaeger-spark-dependencies-elasticsearch | ||
run: ELASTICSEARCH_VERSION=7.3.0 ./mvnw --batch-mode test -pl jaeger-spark-dependencies-elasticsearch | ||
|
||
latest-jaeger-es8: | ||
name: Latest Jaeger and ES8 | ||
|
@@ -55,4 +64,4 @@ jobs: | |
- name: compile | ||
run: ./mvnw --batch-mode clean install -DskipTests | ||
- name: test | ||
run: ELASTICSEARCH_VERSION=8.3.1 ./mvnw --batch-mode clean test -pl jaeger-spark-dependencies-elasticsearch | ||
run: ELASTICSEARCH_VERSION=8.3.1 ./mvnw --batch-mode test -pl jaeger-spark-dependencies-elasticsearch |
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ COPY .mvn $APP_HOME/.mvn | |
COPY mvnw $APP_HOME | ||
|
||
WORKDIR $APP_HOME | ||
RUN --mount=type=cache,target=/root/.m2 ./mvnw package -Dlicense.skip=true -DskipTests | ||
RUN --mount=type=cache,target=/root/.m2 ./mvnw package --batch-mode -Dlicense.skip=true -DskipTests | ||
|
||
FROM eclipse-temurin:11-jre | ||
MAINTAINER Pavol Loffay <[email protected]> | ||
|
54 changes: 54 additions & 0 deletions
54
...ava/io/jaegertracing/spark/dependencies/cassandra/CassandraDependenciesDockerJobTest.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,54 @@ | ||
/** | ||
* Copyright 2017 The Jaeger Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package io.jaegertracing.spark.dependencies.cassandra; | ||
|
||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.awaitility.Awaitility.await; | ||
|
||
public class CassandraDependenciesDockerJobTest extends CassandraDependenciesJobTest { | ||
private static String dependenciesJobTag() { | ||
String tag = System.getenv("SPARK_DEPENDENCIES_JOB_TAG"); | ||
if (tag == null || tag.isEmpty()) { | ||
return "latest"; | ||
} | ||
return tag.trim(); | ||
} | ||
|
||
@Override | ||
protected void deriveDependencies() { | ||
System.out.println("::group::🚧 🚧 🚧 CassandraDependenciesDockerJob logs"); | ||
try (GenericContainer<?> sparkDependenciesJob = new GenericContainer<>( | ||
DockerImageName.parse("ghcr.io/jaegertracing/spark-dependencies/spark-dependencies:" + dependenciesJobTag())) | ||
.withNetwork(network) | ||
.withLogConsumer(new LogToConsolePrinter("[spark-dependencies] ")) | ||
.withEnv("STORAGE", "cassandra") | ||
.withEnv("CASSANDRA_KEYSPACE", "jaeger_v1_dc1") | ||
.withEnv("CASSANDRA_CONTACT_POINTS", "cassandra") // This should be an address within the docker network | ||
.withEnv("CASSANDRA_LOCAL_DC", cassandra.getLocalDatacenter()) | ||
.withEnv("CASSANDRA_USERNAME", cassandra.getUsername()) | ||
.withEnv("CASSANDRA_PASSWORD", cassandra.getPassword()) | ||
.dependsOn(cassandra, jaegerCassandraSchema);){ | ||
sparkDependenciesJob.start(); | ||
await("spark-dependencies-job execution") | ||
.atMost(3, TimeUnit.MINUTES) | ||
.until(() -> !sparkDependenciesJob.isRunning()); | ||
} finally { | ||
System.out.println("::endgroup::"); | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...ndra/src/test/java/io/jaegertracing/spark/dependencies/cassandra/LogToConsolePrinter.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,35 @@ | ||
/** | ||
* Copyright 2017 The Jaeger Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package io.jaegertracing.spark.dependencies.cassandra; | ||
|
||
import org.testcontainers.containers.output.OutputFrame; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public final class LogToConsolePrinter implements Consumer<OutputFrame> { | ||
private final String prefix; | ||
|
||
public LogToConsolePrinter(String prefix) { | ||
this.prefix = prefix; | ||
} | ||
|
||
@Override | ||
public void accept(OutputFrame outputFrame) { | ||
String message = outputFrame.getUtf8String(); | ||
if (!message.isEmpty()) { | ||
System.out.print(prefix); | ||
System.out.print(message); | ||
} | ||
} | ||
} |
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