tgrall commented on a change in pull request #2223:
URL: https://github.com/apache/calcite/pull/2223#discussion_r507090672
##########
File path:
redis/src/test/java/org/apache/calcite/adapter/redis/RedisCaseBase.java
##########
@@ -16,25 +16,90 @@
*/
package org.apache.calcite.adapter.redis;
+import org.apache.calcite.config.CalciteSystemProperty;
+
import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
+import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.logging.Logger;
+
+import redis.embedded.RedisServer;
+
/**
* RedisITCaseBase.
*/
@Execution(ExecutionMode.SAME_THREAD)
public abstract class RedisCaseBase {
+ public static final int PORT = getAvailablePort();
+ public static final String HOST = "127.0.0.1";
+ private static final String MAX_HEAP = "maxheap 51200000";
+ // If Docker is running, a container will be used
public static final GenericContainer<?> REDIS_CONTAINER =
- new GenericContainer<>("redis:6.0.6").withExposedPorts(6379);
+ new GenericContainer<>("redis").withExposedPorts(6379);
+
+ // If docker is not running use a fake server
+ private static RedisServer redisServer;
@BeforeAll
public static void startRedisContainer() {
- REDIS_CONTAINER.start();
+ // Check if docker is running, and start container if possible
+ if (CalciteSystemProperty.TEST_WITH_DOCKER_CONTAINER.value()
+ && DockerClientFactory.instance().isDockerAvailable()) {
+ REDIS_CONTAINER.start();
+ }
+ }
+
+ @BeforeEach
+ public void createRedisServer() throws IOException {
+ if (!REDIS_CONTAINER.isRunning()) {
+ if (isWindows()) {
+ redisServer =
RedisServer.builder().port(PORT).setting(MAX_HEAP).build();
Review comment:
No I cannot clarify ;) - I just restored the initial code to run the
RedisMiniServer and allow the test to run either with Docker or with MiniServer.
See current
[master](https://github.com/apache/calcite/blob/bda7fb188b01c0334a7bf1662101e259321893a4/redis/src/test/java/org/apache/calcite/adapter/redis/RedisCaseBase.java#L43-L47)
_(I have not tested on Windows)_
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]