-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: polishes integration tests (#243)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
- Loading branch information
1 parent
d97c014
commit 2dbac71
Showing
18 changed files
with
224 additions
and
329 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
47 changes: 47 additions & 0 deletions
47
activemq-client/src/test/java/zipkin2/reporter/activemq/ActiveMQContainer.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,47 @@ | ||
/* | ||
* Copyright 2016-2024 The OpenZipkin 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 zipkin2.reporter.activemq; | ||
|
||
import java.time.Duration; | ||
import org.apache.activemq.ActiveMQConnectionFactory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.output.Slf4jLogConsumer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
|
||
import static org.testcontainers.utility.DockerImageName.parse; | ||
|
||
final class ActiveMQContainer extends GenericContainer<ActiveMQContainer> { | ||
static final Logger LOGGER = LoggerFactory.getLogger(ActiveMQContainer.class); | ||
static final int ACTIVEMQ_PORT = 61616; | ||
|
||
ActiveMQContainer() { | ||
super(parse("ghcr.io/openzipkin/zipkin-activemq:3.0.2")); | ||
withExposedPorts(ACTIVEMQ_PORT); | ||
waitStrategy = Wait.forListeningPorts(ACTIVEMQ_PORT); | ||
withStartupTimeout(Duration.ofSeconds(60)); | ||
withLogConsumer(new Slf4jLogConsumer(LOGGER)); | ||
} | ||
|
||
ActiveMQSender.Builder newSenderBuilder(String queue) { | ||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); | ||
connectionFactory.setBrokerURL(brokerURL()); | ||
return ActiveMQSender.newBuilder().queue(queue).connectionFactory(connectionFactory); | ||
} | ||
|
||
String brokerURL() { | ||
return "failover:tcp://" + getHost() + ":" + getMappedPort(ACTIVEMQ_PORT); | ||
} | ||
} |
76 changes: 0 additions & 76 deletions
76
activemq-client/src/test/java/zipkin2/reporter/activemq/ActiveMQExtension.java
This file was deleted.
Oops, something went wrong.
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
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
64 changes: 64 additions & 0 deletions
64
amqp-client/src/test/java/zipkin2/reporter/amqp/RabbitMQContainer.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,64 @@ | ||
/* | ||
* Copyright 2016-2024 The OpenZipkin 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 zipkin2.reporter.amqp; | ||
|
||
import java.time.Duration; | ||
import org.opentest4j.TestAbortedException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.output.Slf4jLogConsumer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
|
||
import static org.testcontainers.utility.DockerImageName.parse; | ||
import static zipkin2.reporter.Call.propagateIfFatal; | ||
|
||
final class RabbitMQContainer extends GenericContainer<RabbitMQContainer> { | ||
static final Logger LOGGER = LoggerFactory.getLogger(RabbitMQContainer.class); | ||
static final int RABBIT_PORT = 5672; | ||
|
||
RabbitMQContainer() { | ||
super(parse("ghcr.io/openzipkin/zipkin-rabbitmq:3.0.2")); | ||
withExposedPorts(RABBIT_PORT); | ||
waitStrategy = Wait.forLogMessage(".*Server startup complete.*", 1); | ||
withStartupTimeout(Duration.ofSeconds(60)); | ||
withLogConsumer(new Slf4jLogConsumer(LOGGER)); | ||
} | ||
|
||
RabbitMQSender.Builder newSenderBuilder(String queue) { | ||
declareQueue(queue); | ||
return RabbitMQSender.newBuilder().queue(queue).addresses(host() + ":" + port()); | ||
} | ||
|
||
void declareQueue(String queue) { | ||
ExecResult result; | ||
try { | ||
result = execInContainer("amqp-declare-queue", "-q", queue); | ||
} catch (Throwable e) { | ||
propagateIfFatal(e); | ||
throw new TestAbortedException("Couldn't declare queue " + queue + ": " + e.getMessage(), e); | ||
} | ||
if (result.getExitCode() != 0) { | ||
throw new TestAbortedException("Couldn't declare queue " + queue + ": " + result); | ||
} | ||
} | ||
|
||
String host() { | ||
return getHost(); | ||
} | ||
|
||
int port() { | ||
return getMappedPort(RABBIT_PORT); | ||
} | ||
} |
94 changes: 0 additions & 94 deletions
94
amqp-client/src/test/java/zipkin2/reporter/amqp/RabbitMQExtension.java
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.