Reputation: 13
I'm encountering an issue with my Quarkus application where I'm unable to establish a connection to Redis during testing, resulting in failures.
I have a Quarkus application that relies on Redis for data storage.
I have installed Redis on my Pc.
During testing, attempts to connect to Redis (192.168.1.100:6379
) are failing.
I've confirmed that Redis is running on the specified IP address (192.168.1.100
) and port (6379
) using tools like telnet
and ping
, which are also unsuccessful.
The test failures seem related to Redis not being available or accessible during the test execution.
Checked Redis configuration (redis.conf
) to ensure it's listening on the correct IP and port.
Verified firewall settings to ensure that traffic on port 6379
is allowed.
Attempted direct connection using redis-cli
from the command line, which also failed.
Investigated possible network issues (e.g., ping and telnet not reaching the Redis server).
This the log console when I try to run tests:
C:\Users\U765123\.jdks\openjdk-20\bin\java.exe -ea -Djava.util.logging.manager=org.jboss.logmanager.LogManager "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA 2023.3.2\plugins\maven\lib\maven3" -Dquarkus.test.profile=test,jenkins -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2023.3.2\lib\idea_rt.jar=20696:C:\Program Files\JetBrains\IntelliJ IDEA 2023.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 @C:\Users\U765123\AppData\Local\Temp\idea_arg_file523591125 com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 @w@C:\Users\U765123\AppData\Local\Temp\idea_working_dirs_junit1.tmp @C:\Users\U765123\AppData\Local\Temp\idea_junit1.tmp
2024-04-08 11:53:51,056 INFO [org.tes.doc.DockerClientProviderStrategy] (build-21) Loaded org.testcontainers.dockerclient.NpipeSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
2024-04-08 11:53:52,278 INFO [org.tes.doc.DockerClientProviderStrategy] (build-21) Found Docker environment with local Npipe socket (npipe:////./pipe/docker_engine)
2024-04-08 11:53:52,303 INFO [org.tes.DockerClientFactory] (build-21) Docker host IP address is localhost
2024-04-08 11:53:52,384 INFO [org.tes.DockerClientFactory] (build-21) Connected to docker:
Server Version: 20.10.20
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 25385 MB
2024-04-08 11:53:52,558 INFO [org.tes.ima.PullPolicy] (build-21) Image pull policy will be performed by: DefaultPullPolicy()
2024-04-08 11:53:52,568 INFO [org.tes.uti.ImageNameSubstitutor] (build-21) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2024-04-08 11:53:52,595 INFO [org.tes.DockerClientFactory] (build-21) Checking the system...
2024-04-08 11:53:52,597 INFO [org.tes.DockerClientFactory] (build-21) ✔︎ Docker server version should be at least 1.6.0
2024-04-08 11:53:52,653 INFO [tc.mongo:latest] (build-21) Creating container for image: mongo:latest
2024-04-08 11:53:53,395 INFO [org.tes.uti.RegistryAuthLocator] (build-21) Credential helper/store (docker-credential-desktop) does not have credentials for https://index.docker.io/v1/
2024-04-08 11:53:53,455 INFO [tc.tes.5.1] (build-21) Creating container for image: testcontainers/ryuk:0.5.1
2024-04-08 11:53:53,653 INFO [tc.tes.5.1] (build-21) Container testcontainers/ryuk:0.5.1 is starting: 13b4229d8afb17d2f14e1e3c52e49150d0c9456dbe944c31bca63d5432938c7c
2024-04-08 11:53:55,003 INFO [tc.tes.5.1] (build-21) Container testcontainers/ryuk:0.5.1 started in PT1.5480268S
2024-04-08 11:53:55,176 INFO [tc.mongo:latest] (build-21) Container mongo:latest is starting: 440cf84dde94121fed2904e95470eb85ae336fb28081da5614bcf6fb7c14f894
2024-04-08 11:53:57,429 INFO [tc.mongo:latest] (build-21) Container mongo:latest started in PT4.7760203S
java.lang.RuntimeException: java.lang.RuntimeException: Unable to start Quarkus test resource class de.dlh.lht.ams.jcc.util.RedisTestResourceLifecycleManager
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:638)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:722)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.RuntimeException: Unable to start Quarkus test resource class de.dlh.lht.ams.jcc.util.RedisTestResourceLifecycleManager
at io.quarkus.test.common.TestResourceManager$TestResourceEntryRunnable.run(TestResourceManager.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.io.IOException: Failed to start Redis service
at redis.embedded.RedisInstance.start(RedisInstance.java:44)
at de.dlh.lht.ams.jcc.util.RedisTestResourceLifecycleManager.start(RedisTestResourceLifecycleManager.java:19)
at io.quarkus.test.common.TestResourceManager$TestResourceEntryRunnable.run(TestResourceManager.java:500)
... 4 more
Caused by: java.io.IOException: Ready pattern not found in log. Startup log:
[32280] 08 Apr 11:54:00.302 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
[32280] 08 Apr 11:54:00.302 # Redis version=5.0.14.1, bits=64, commit=ec77f72d, modified=0, pid=32280, just started
[32280] 08 Apr 11:54:00.302 # Configuration loaded
[32280] 08 Apr 11:54:00.305 # Could not create server TCP listening socket 127.0.0.1:6379: bind: An operation was attempted on something that is not a socket.
at redis.embedded.RedisInstance.awaitServerReady(RedisInstance.java:51)
at redis.embedded.RedisInstance.start(RedisInstance.java:40)
... 6 more
Here is Redis:
C:\Users\U765123>redis-server
[23696] 08 Apr 11:12:50.638 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
[23696] 08 Apr 11:12:50.638 # Redis version=5.0.14.1, bits=64, commit=ec77f72d, modified=0, pid=23696, just started
[23696] 08 Apr 11:12:50.639 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.14.1 (ec77f72d/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 23696
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[23696] 08 Apr 11:12:50.644 # Server initialized
[23696] 08 Apr 11:12:50.654 * DB loaded from disk: 0.009 seconds
[23696] 08 Apr 11:12:50.654 * Ready to accept connections
But:
C:\Users\U765123>PING 192.168.1.100
Pinging 192.168.1.100 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.1.100:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
and
C:\Users\U765123>redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379>
I dont understand why this is happening. How can I troubleshoot and resolve the connectivity issue between my Quarkus application and Redis?Are there additional configuration settings or steps I should consider to ensure Redis is accessible during testing?
this is my lifecycle manager:
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import lombok.SneakyThrows;
import redis.embedded.RedisServer;
import java.util.Map;
public class RedisTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {
private RedisServer redisServer;
@SneakyThrows
@Override
public Map<String, String> start() {
redisServer = new RedisServer();
redisServer.start();
return null;
}
@SneakyThrows
@Override
public void stop() {
redisServer.stop();
}
}
I recentry get this:
java.util.concurrent.CompletionException: ERR unknown command `getex`, with args beginning with: `cache:all-layover-panels:1242`, `EX`, `345600`,
at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:79)
at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)
at io.smallrye.mutiny.groups.UniAwait.indefinitely(UniAwait.java:46)
at io.quarkus.cache.runtime.CacheResultInterceptor.intercept(CacheResultInterceptor.java:153)
at io.quarkus.cache.runtime.CacheResultInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
at de.dlh.lht.ams.jcc.service.jobcard.PanelJobcardService_Subclass.getAllLayoverPanels(Unknown Source)
at de.dlh.lht.ams.jcc.service.jobcard.PanelJobcardService_ClientProxy.getAllLayoverPanels(Unknown Source)
at de.dlh.lht.ams.jcc.service.jobcard.PanelJobcardServiceTest.testGetAllLayoverPanels(PanelJobcardServiceTest.java:249)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1013)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:827)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: ERR unknown command getex
, with args beginning with: cache:all-layover-panels:1242
, EX
, 345600
,
Upvotes: 0
Views: 444