beryllw commented on PR #1285: URL: https://github.com/apache/fluss/pull/1285#issuecomment-3047465295
Currently, we can only map to fixed ports. To achieve functionality similar to the Kafka container, we could implement it in TestContainers, as seen [here](https://github.com/testcontainers/testcontainers-java/blob/main/modules/kafka/src/main/java/org/testcontainers/containers/KafkaContainer.java). For now, we can use `GenericContainer` to expose fixed ports for testing purposes. Here's an example implementation: ```java @Testcontainers public class FlussContainer extends GenericContainer<FlussContainer> { private static final String DOCKER_IMAGE_NAME = "fluss-xxxx:latest"; // Exposed ports public static final int COORDINATOR_PORT = 9123; public static final int TABLET_PORT = 9124; public static final Network NETWORK = Network.newNetwork(); public FlussContainer() { super(DockerImageName.parse(DOCKER_IMAGE_NAME)); withExposedPorts(COORDINATOR_PORT, TABLET_PORT); setNetwork(NETWORK); } public FlussContainer(Network network) { super(DockerImageName.parse(DOCKER_IMAGE_NAME)); setExposedPorts(Arrays.asList(COORDINATOR_PORT, TABLET_PORT)); setNetwork(network); } } ``` This allows for testing with fixed ports using `GenericContainer`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
