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

Tests: use pulsar server in docker #120

Merged
merged 11 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -465,8 +465,8 @@ public void testPatternConsumerAddingTopicWithServerSideFilters() throws Excepti
pulsarContainer
.getAdmin()
.topics()
.createSubscription(
topicName, "jms-queue", MessageId.earliest, false, subscriptionProperties);
.updateSubscriptionProperties(
nicoloboschi marked this conversation as resolved.
Show resolved Hide resolved
topicName, "jms-queue", subscriptionProperties);

Queue newDestination = session.createQueue(topicName);
TextMessage nextMessage = session.createTextMessage("new");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

@Slf4j
public class PulsarContainerExtension implements BeforeAllCallback, AfterAllCallback {
public static final String PULSAR_IMAGE = "apachepulsar/pulsar:3.0.0";
private PulsarContainer pulsarContainer;
private Consumer<PulsarContainerExtension> onContainerReady;
private Map<String, String> env = new HashMap<>();
Expand Down Expand Up @@ -67,7 +68,7 @@ public void afterAll(ExtensionContext extensionContext) {
public void beforeAll(ExtensionContext extensionContext) {
network = Network.newNetwork();
pulsarContainer =
new PulsarContainer(DockerImageName.parse("apachepulsar/pulsar:3.0.0"))
new PulsarContainer(DockerImageName.parse(PULSAR_IMAGE))
.withNetwork(network)
.withEnv(env)
.withLogConsumer(
Expand All @@ -76,13 +77,13 @@ public void beforeAll(ExtensionContext extensionContext) {
MountableFile.forHostPath("target/classes/filters"), "/pulsar/filters");
// start Pulsar and wait for it to be ready to accept requests
pulsarContainer.start();
admin =
PulsarAdmin.builder()
.serviceHttpUrl("http://localhost:" + pulsarContainer.getMappedPort(8080))
.build();
if (onContainerReady != null) {
onContainerReady.accept(this);
}
admin =
PulsarAdmin.builder()
.serviceHttpUrl("http://localhost:" + pulsarContainer.getMappedPort(8080))
.build();
}

public PulsarContainerExtension withOnContainerReady(
Expand Down
Loading