diff --git a/dao/pom.xml b/dao/pom.xml
index ab62d8f013..700d2b0135 100644
--- a/dao/pom.xml
+++ b/dao/pom.xml
@@ -216,6 +216,11 @@
jdbc
test
+
+ org.testcontainers
+ junit-jupiter
+ test
+
org.springframework
spring-context-support
diff --git a/dao/src/test/java/org/thingsboard/server/dao/RedisJUnit5Test.java b/dao/src/test/java/org/thingsboard/server/dao/RedisJUnit5Test.java
new file mode 100644
index 0000000000..43e788cccb
--- /dev/null
+++ b/dao/src/test/java/org/thingsboard/server/dao/RedisJUnit5Test.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright © 2016-2024 The Thingsboard Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.thingsboard.server.dao;
+
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.OutputFrame;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@Testcontainers
+@Slf4j
+public class RedisJUnit5Test {
+
+ @Container
+ private static final GenericContainer REDIS = new GenericContainer("redis:7.2-bookworm")
+ .withLogConsumer(s -> log.error(((OutputFrame) s).getUtf8String().trim()))
+ .withExposedPorts(6379);
+
+ @BeforeAll
+ static void beforeAll() {
+ log.warn("Starting redis...");
+ REDIS.start();
+ System.setProperty("cache.type", "redis");
+ System.setProperty("redis.connection.type", "standalone");
+ System.setProperty("redis.standalone.host", REDIS.getHost());
+ System.setProperty("redis.standalone.port", String.valueOf(REDIS.getMappedPort(6379)));
+
+ }
+
+ @AfterAll
+ static void afterAll() {
+ List.of("cache.type", "redis.connection.type", "redis.standalone.host", "redis.standalone.port")
+ .forEach(System.getProperties()::remove);
+ REDIS.stop();
+ log.warn("Redis is stopped");
+ }
+
+ @Test
+ void test() {
+ assertThat(REDIS.isRunning()).isTrue();
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index d2450e0a65..70a35d77d2 100755
--- a/pom.xml
+++ b/pom.xml
@@ -2021,6 +2021,18 @@
+
+ org.testcontainers
+ junit-jupiter
+ ${testcontainers.version}
+ test
+
+
+ junit
+ junit
+
+
+
org.zeroturnaround
zt-exec