Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation of o.t.containers.CassandraContainer + KafkaContainer #9680

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,24 @@
import org.projectnessie.model.ImmutableCommitMeta;
import org.projectnessie.model.Reference;
import org.projectnessie.nessie.testing.containerspec.ContainerSpecHelper;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.kafka.ConfluentKafkaContainer;

@TestInstance(Lifecycle.PER_CLASS)
abstract class AbstractKafkaEventSubscriberTests {

protected static final Network NETWORK = Network.newNetwork();

@Container
protected static final KafkaContainer KAFKA =
new KafkaContainer(
protected static final ConfluentKafkaContainer KAFKA =
new ConfluentKafkaContainer(
ContainerSpecHelper.builder()
.name("kafka")
.containerClass(ITKafkaAvroEventSubscriber.class)
.build()
.dockerImageName(null))
.dockerImageName(null)
.asCompatibleSubstituteFor("confluentinc/cp-kafka"))
.withNetwork(NETWORK)
.withNetworkAliases("broker");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ITKafkaAvroEventSubscriber extends AbstractKafkaEventSubscriberTest
.dependsOn(KAFKA)
.withExposedPorts(8081)
.withEnv("SCHEMA_REGISTRY_HOST_NAME", "schemaregistry")
.withEnv("SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS", "broker:9092");
.withEnv("SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS", "broker:9093");

@Override
protected Class<?> subscriberClass() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dockerfile to provide the image name and tag to a test.
# Version is managed by Renovate - do not edit.
FROM confluentinc/cp-kafka:7.7.1
FROM docker.io/confluentinc/cp-kafka:7.7.1

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dockerfile to provide the image name and tag to a test.
# Version is managed by Renovate - do not edit.
FROM confluentinc/cp-schema-registry:7.7.1
FROM docker.io/confluentinc/cp-schema-registry:7.7.1

1 change: 1 addition & 0 deletions servers/quarkus-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ dependencies {
intTestCompileOnly(project(":nessie-immutables"))
intTestAnnotationProcessor(project(":nessie-immutables", configuration = "processor"))

intTestImplementation(enforcedPlatform(libs.testcontainers.bom))
intTestImplementation("io.quarkus:quarkus-test-keycloak-server")
intTestImplementation(project(":nessie-keycloak-testcontainer"))
intTestImplementation(libs.lowkey.vault.testcontainers)
Expand Down
1 change: 1 addition & 0 deletions tools/server-admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ dependencies {

testFixturesApi(project(":nessie-quarkus-tests"))
testFixturesApi(project(":nessie-versioned-tests"))
intTestImplementation(enforcedPlatform(libs.testcontainers.bom))
intTestImplementation(project(":nessie-versioned-storage-mongodb-tests"))
intTestImplementation(project(":nessie-versioned-storage-mongodb2-tests"))
intTestImplementation(project(":nessie-versioned-storage-jdbc-tests"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.projectnessie.versioned.storage.cassandratests;

import static java.lang.String.format;
import static org.testcontainers.containers.CassandraContainer.CQL_PORT;

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.metadata.Metadata;
Expand All @@ -32,7 +31,7 @@
import org.projectnessie.versioned.storage.testextension.BackendTestFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;
import org.testcontainers.containers.ContainerLaunchException;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;
Expand All @@ -42,11 +41,12 @@ public abstract class AbstractCassandraBackendTestFactory implements BackendTest
private static final Logger LOGGER =
LoggerFactory.getLogger(AbstractCassandraBackendTestFactory.class);
public static final String KEYSPACE_FOR_TEST = "nessie";
public static final Integer CQL_PORT = 9042;

private final String dbName;
private final List<String> args;

private CassandraContainer<?> container;
private CassandraContainer container;
private InetSocketAddress hostAndPort;
private String localDc;

Expand Down Expand Up @@ -116,8 +116,8 @@ public void start(Optional<String> containerNetworkId) {
.asCompatibleSubstituteFor("cassandra");

for (int retry = 0; ; retry++) {
CassandraContainer<?> c =
new CassandraContainer<>(dockerImageName)
CassandraContainer c =
new CassandraContainer(dockerImageName)
.withLogConsumer(new Slf4jLogConsumer(LOGGER))
.withCommand(args.toArray(new String[0]));
configureContainer(c);
Expand Down Expand Up @@ -160,7 +160,7 @@ public String getLocalDc() {
return localDc;
}

protected abstract void configureContainer(CassandraContainer<?> c);
protected abstract void configureContainer(CassandraContainer c);

@Override
public void start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static java.util.Collections.emptyList;

import org.projectnessie.versioned.storage.cassandra.CassandraBackendFactory;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;

public class CassandraBackendTestFactory extends AbstractCassandraBackendTestFactory {

Expand All @@ -37,7 +37,7 @@ public String getName() {
}

@Override
protected void configureContainer(CassandraContainer<?> c) {
protected void configureContainer(CassandraContainer c) {
c.withEnv("JVM_OPTS", JVM_OPTS_TEST);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static java.lang.String.format;
import static java.util.Arrays.asList;

import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;

public class ScyllaDBBackendTestFactory extends AbstractCassandraBackendTestFactory {

Expand All @@ -47,5 +47,5 @@ public String getName() {
}

@Override
protected void configureContainer(CassandraContainer<?> c) {}
protected void configureContainer(CassandraContainer c) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.projectnessie.versioned.storage.cassandra2tests;

import static java.lang.String.format;
import static org.testcontainers.containers.CassandraContainer.CQL_PORT;

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.metadata.Metadata;
Expand All @@ -32,7 +31,7 @@
import org.projectnessie.versioned.storage.testextension.BackendTestFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;
import org.testcontainers.containers.ContainerLaunchException;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;
Expand All @@ -42,11 +41,12 @@ public abstract class AbstractCassandraBackendTestFactory implements BackendTest
private static final Logger LOGGER =
LoggerFactory.getLogger(AbstractCassandraBackendTestFactory.class);
public static final String KEYSPACE_FOR_TEST = "nessie";
public static final Integer CQL_PORT = 9042;

private final String dbName;
private final List<String> args;

private CassandraContainer<?> container;
private CassandraContainer container;
private InetSocketAddress hostAndPort;
private String localDc;

Expand Down Expand Up @@ -117,8 +117,8 @@ public void start(Optional<String> containerNetworkId) {
.asCompatibleSubstituteFor("cassandra");

for (int retry = 0; ; retry++) {
CassandraContainer<?> c =
new CassandraContainer<>(dockerImageName)
CassandraContainer c =
new CassandraContainer(dockerImageName)
.withLogConsumer(new Slf4jLogConsumer(LOGGER))
.withCommand(args.toArray(new String[0]));
configureContainer(c);
Expand Down Expand Up @@ -161,7 +161,7 @@ public String getLocalDc() {
return localDc;
}

protected abstract void configureContainer(CassandraContainer<?> c);
protected abstract void configureContainer(CassandraContainer c);

@Override
public void start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static java.util.Collections.emptyList;

import org.projectnessie.versioned.storage.cassandra2.Cassandra2BackendFactory;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;

public class CassandraBackendTestFactory extends AbstractCassandraBackendTestFactory {

Expand All @@ -37,7 +37,7 @@ public String getName() {
}

@Override
protected void configureContainer(CassandraContainer<?> c) {
protected void configureContainer(CassandraContainer c) {
c.withEnv("JVM_OPTS", JVM_OPTS_TEST);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static java.lang.String.format;
import static java.util.Arrays.asList;

import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.cassandra.CassandraContainer;

public class ScyllaDBBackendTestFactory extends AbstractCassandraBackendTestFactory {

Expand All @@ -47,5 +47,5 @@ public String getName() {
}

@Override
protected void configureContainer(CassandraContainer<?> c) {}
protected void configureContainer(CassandraContainer c) {}
}