-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 테스트 redis 환경 testContainer으로 변경
- Loading branch information
Showing
10 changed files
with
61 additions
and
184 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
38 changes: 0 additions & 38 deletions
38
backend/src/test/java/kr/momo/support/CacheCleanupListener.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
backend/src/test/java/kr/momo/support/EnableEmbeddedCache.java
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
backend/src/test/java/kr/momo/support/IsolateDatabaseAndCache.java
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
package kr.momo.support; | ||
|
||
import com.redis.testcontainers.RedisContainer; | ||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
import org.testcontainers.junit.jupiter.Container; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
@Testcontainers | ||
public abstract class TestContainers { | ||
|
||
private static final String REDIS_IMAGE = "redis:6-alpine"; | ||
private static final int REDIS_PORT = 6379; | ||
@Container | ||
private static final RedisContainer REDIS_CONTAINER; | ||
|
||
static { | ||
REDIS_CONTAINER = new RedisContainer(DockerImageName.parse(REDIS_IMAGE)) | ||
.withExposedPorts(REDIS_PORT); | ||
REDIS_CONTAINER.start(); | ||
} | ||
|
||
@DynamicPropertySource | ||
private static void databaseProperties(DynamicPropertyRegistry registry) { | ||
registry.add("spring.data.redis.host", REDIS_CONTAINER::getHost); | ||
registry.add("spring.data.redis.port", () -> REDIS_CONTAINER.getMappedPort(REDIS_PORT).toString()); | ||
} | ||
} |
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