Fix Stream TestContainer

- do not close the container; used by other tests.
This commit is contained in:
Gary Russell
2022-09-28 12:14:24 -04:00
parent 4ee9d21a57
commit 0cce53331a

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021 the original author or authors.
* Copyright 2021-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.springframework.rabbit.stream.support;
import java.time.Duration;
import org.junit.jupiter.api.AfterAll;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.RabbitMQContainer;
@@ -43,28 +42,29 @@ public abstract class AbstractIntegrationTests {
.withExposedPorts(5672, 15672, 5552)
.withPluginsEnabled("rabbitmq_stream", "rabbitmq_management")
.withStartupTimeout(Duration.ofMinutes(2));
System.out.println("Created");
RABBITMQ.start();
System.out.println("Started");
}
else {
RABBITMQ = null;
}
System.out.println(RABBITMQ);
}
public static int amqpPort() {
System.out.println("amqp:" + RABBITMQ);
return RABBITMQ != null ? RABBITMQ.getMappedPort(5672) : 5672;
}
public static int managementPort() {
System.out.println("mgmt:" + RABBITMQ);
return RABBITMQ != null ? RABBITMQ.getMappedPort(15672) : 15672;
}
public static int streamPort() {
System.out.println("stream:" + RABBITMQ);
return RABBITMQ != null ? RABBITMQ.getMappedPort(5552) : 5552;
}
@AfterAll
static void shutDown() {
RABBITMQ.close();
}
}