|
40 | 40 | import org.slf4j.Logger;
|
41 | 41 | import org.slf4j.LoggerFactory;
|
42 | 42 | import org.testcontainers.containers.GenericContainer;
|
| 43 | +import org.testcontainers.containers.Network; |
43 | 44 | import org.testcontainers.containers.wait.strategy.Wait;
|
44 | 45 |
|
45 | 46 | import java.util.Collections;
|
@@ -106,24 +107,28 @@ public int order() {
|
106 | 107 | public Map<String, String> start() {
|
107 | 108 | if (!Boolean.parseBoolean(System.getProperty("cluster.tests"))) {
|
108 | 109 |
|
109 |
| - String bootstrapServers = System.getProperty("bootstrap.servers"); |
| 110 | + String externalBootstrapServers = System.getProperty("bootstrap.servers.external"); |
| 111 | + String internalBootstrapServers = System.getProperty("bootstrap.servers.internal"); |
110 | 112 |
|
111 |
| - genericContainer = new GenericContainer("quay.io/apicurio/apicurio-registry-kafkasql:2.1.2.Final") |
112 |
| - .withEnv(Map.of("KAFKA_BOOTSTRAP_SERVERS", bootstrapServers, "QUARKUS_HTTP_PORT", "8081")); |
| 113 | + genericContainer = new GenericContainer<>("quay.io/apicurio/apicurio-registry-kafkasql:2.1.2.Final") |
| 114 | + .withEnv(Map.of("KAFKA_BOOTSTRAP_SERVERS", internalBootstrapServers, "QUARKUS_HTTP_PORT", "8081")) |
| 115 | + .withExposedPorts(8081) |
| 116 | + .withNetwork(Network.SHARED); |
113 | 117 |
|
| 118 | + genericContainer.setPortBindings(List.of("8081:8081")); |
| 119 | + genericContainer.waitingFor(Wait.forHttp("/apis/registry/v2/search/artifacts").forStatusCode(200)); |
| 120 | + genericContainer.start(); |
114 | 121 | //create the topic with agressive log compaction
|
115 |
| - createTopic("kafkasql-journal", 1, bootstrapServers); |
116 |
| - |
| 122 | + createTopic("kafkasql-journal", 1, externalBootstrapServers); |
117 | 123 | genericContainer.start();
|
118 |
| - genericContainer.waitingFor(Wait.forLogMessage(".*(KSQL Kafka Consumer Thread) KafkaSQL storage bootstrapped.*", 1)); |
119 | 124 |
|
120 | 125 | var registryClient = RegistryClientFactory.create("http://localhost:8081");
|
121 | 126 |
|
122 | 127 | try {
|
123 |
| - RegistryWaitUtils.retry(registryClient, registryClient1 -> CustomTestsUtils.createArtifact(registryClient, ArtifactType.AVRO, ApicurioRegistryBaseIT.resourceToString("artifactTypes/" + "avro/multi-field_v1.json"))); |
| 128 | + RegistryWaitUtils.retry(registryClient, registryClient1 -> CustomTestsUtils.createArtifact(registryClient, PREPARE_LOG_COMPACTION, ArtifactType.AVRO, ApicurioRegistryBaseIT.resourceToString("artifactTypes/" + "avro/multi-field_v1.json"))); |
124 | 129 |
|
125 |
| - var artifactdata = CustomTestsUtils.createArtifact(registryClient, ArtifactType.JSON, ApicurioRegistryBaseIT.resourceToString("artifactTypes/" + "jsonSchema/person_v1.json")); |
126 |
| - CustomTestsUtils.createArtifact(registryClient, ArtifactType.PROTOBUF, ApicurioRegistryBaseIT.resourceToString("artifactTypes/" + "protobuf/tutorial_v1.proto")); |
| 130 | + var artifactdata = CustomTestsUtils.createArtifact(registryClient, PREPARE_LOG_COMPACTION, ArtifactType.JSON, ApicurioRegistryBaseIT.resourceToString("artifactTypes/" + "jsonSchema/person_v1.json")); |
| 131 | + CustomTestsUtils.createArtifact(registryClient, PREPARE_LOG_COMPACTION, ArtifactType.PROTOBUF, ApicurioRegistryBaseIT.resourceToString("artifactTypes/" + "protobuf/tutorial_v1.proto")); |
127 | 132 |
|
128 | 133 | assertEquals(3, registryClient.listArtifactsInGroup(PREPARE_LOG_COMPACTION).getCount());
|
129 | 134 |
|
@@ -165,15 +170,11 @@ public AdminClient adminClient(String bootstrapServers) {
|
165 | 170 | public void createTopic(String topic, int partitions, String bootstrapServers) {
|
166 | 171 | var journal = new NewTopic(topic, partitions, (short) 1);
|
167 | 172 |
|
168 |
| - /*journal.configs(Map.of( |
| 173 | + journal.configs(Map.of( |
169 | 174 | "min.cleanable.dirty.ratio","0.000001",
|
170 | 175 | "cleanup.policy","compact",
|
171 | 176 | "segment.ms", "100",
|
172 | 177 | "delete.retention.ms", "100"
|
173 |
| - ));*/ |
174 |
| - |
175 |
| - journal.configs(Map.of( |
176 |
| - "cleanup.policy", "compact" |
177 | 178 | ));
|
178 | 179 |
|
179 | 180 | adminClient(bootstrapServers).createTopics(List.of(journal));
|
|
0 commit comments