-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
75 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
@ActiveProfiles("test") | ||
@Configuration | ||
public class RedisTestConfig { | ||
static final String REDIS_IMAGE = "redis:6-alpine"; | ||
static final GenericContainer REDIS_CONTAINER; | ||
|
||
static { | ||
REDIS_CONTAINER = | ||
new GenericContainer<>(REDIS_IMAGE) | ||
.withExposedPorts(6379) | ||
.withCommand("--requirepass", "123456") | ||
.withReuse(true); | ||
REDIS_CONTAINER.start(); | ||
} | ||
|
||
@DynamicPropertySource | ||
public static void overrideProps(DynamicPropertyRegistry registry) { | ||
registry.add("spring.redis.host", REDIS_CONTAINER::getHost); | ||
registry.add("spring.redis.port", () -> "" + REDIS_CONTAINER.getMappedPort(6379)); | ||
registry.add("spring.redis.password", () -> "123456"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package config; | ||
|
||
import kr.bb.notification.common.annotation.DuplicateEventHandleAnnotation; | ||
import kr.bb.notification.common.aop.DuplicateEventHandlerAop; | ||
import org.redisson.api.RedissonClient; | ||
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@SpringBootTest | ||
@Transactional | ||
@ActiveProfiles("test") | ||
public class TestENV { | ||
@MockBean private RedissonClient redissonClient; | ||
@MockBean private DuplicateEventHandlerAop duplicateEventHandlerAop; | ||
@MockBean private MetricsAutoConfiguration metricsAutoConfiguration; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
spring: | ||
redis: | ||
host: localhost | ||
port: 6379 | ||
password: 123456 | ||
cloud: | ||
config: | ||
enabled: false | ||
|