fix(test): H2 수명과 컨텍스트 격리를 정리해 테스트 자원 누적을 줄인다
This commit is contained in:
@@ -19,6 +19,14 @@
|
|||||||
- Redis가 필요한 통합 테스트만 `@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])`로 명시적으로 opt-in 한다.
|
- Redis가 필요한 통합 테스트만 `@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])`로 명시적으로 opt-in 한다.
|
||||||
- Redis가 필요 없는 JPA/QueryDSL 슬라이스 테스트는 기존 관례처럼 `@DataJpaTest(properties = ["spring.cache.type=none"])`로 캐시를 끈다.
|
- Redis가 필요 없는 JPA/QueryDSL 슬라이스 테스트는 기존 관례처럼 `@DataJpaTest(properties = ["spring.cache.type=none"])`로 캐시를 끈다.
|
||||||
|
|
||||||
|
## 테스트 자원 수명과 context 재사용
|
||||||
|
- 같은 종류의 통합 테스트는 기존 properties, profile, initializer, bean override 구성을 우선 재사용한다. 불필요한 클래스별 `@MockBean`/`@SpyBean`·설정 차이는 별도 context를 만든다. 격리를 위한 차이는 유지한다.
|
||||||
|
- Hikari가 관리하는 테스트 H2는 context별 DB 이름을 유지하고 `DB_CLOSE_DELAY=0`을 사용한다. 마지막 연결 종료 뒤에도 DB를 유지해야 하는 테스트는 그 이유와 명시적인 종료 책임을 증명한다. `create-drop`만으로 DB 엔진 종료를 대신하지 않는다.
|
||||||
|
- 상속한 test support에서 서로 다른 Spring context를 만들 수 있다면 H2 이름에 `${random.uuid}`처럼 context별 고유 값을 사용한다. 고정 이름을 공유하면 한 context의 `create-drop` 종료가 다른 context의 테이블을 삭제할 수 있다.
|
||||||
|
- 단순 DB fixture 정리에 `@DirtiesContext`를 추가하지 않는다. rollback 범위 밖의 commit·`REQUIRES_NEW`·비동기 데이터는 테스트가 정리하고, context 상태 복구가 불가능한 경우에만 context를 폐기한다.
|
||||||
|
- 테스트가 만든 executor, client, 임시 서버와 비동기 작업은 실패 경로에서도 정리한다. latch/Future 대기에 제한을 두고, 작업 해제·취소 후 executor 종료 완료를 확인한다.
|
||||||
|
- 메모리 부족을 테스트 skip, assertion 완화, 무조건적인 heap 증설로 해결하지 않는다. GC 로그와 실제 보유 객체, context 수명부터 확인한다. worker 교체는 별도 보호 장치이며 누적 원인 수정의 대체물이 아니다.
|
||||||
|
|
||||||
## 저장 시각·응답 왕복 검증 규칙
|
## 저장 시각·응답 왕복 검증 규칙
|
||||||
- DB 재조회 시각과 API 응답을 비교하는 테스트는 OS의 현재 시각만 사용하지 않는다. 기존 시각 주입 seam을 재사용해
|
- DB 재조회 시각과 API 응답을 비교하는 테스트는 OS의 현재 시각만 사용하지 않는다. 기존 시각 주입 seam을 재사용해
|
||||||
나노초 `0`, `123456789`, `999999999`와 `23:59:59` 같은 초/날짜 경계 입력을 고정한다.
|
나노초 `0`, `123456789`, `999999999`와 `23:59:59` 같은 초/날짜 경계 입력을 고정한다.
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-chat-banner-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-chat-banner-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ import javax.persistence.EntityManager
|
|||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"cloud.aws.s3.bucket=test-bucket",
|
"cloud.aws.s3.bucket=test-bucket",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-content-banner-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-content-banner-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-series-banner-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-series-banner-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ import java.time.LocalDateTime
|
|||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"cloud.aws.s3.bucket=test-bucket",
|
"cloud.aws.s3.bucket=test-bucket",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-event-banner-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-event-banner-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-live-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-live-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-live-service-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-live-service-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:charge-controller-http;" +
|
"spring.datasource.url=jdbc:h2:mem:charge-controller-http;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE",
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE",
|
||||||
"jwt.secret=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==",
|
"jwt.secret=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==",
|
||||||
"apple.iap-verify-url=https://apple.invalid/verifyReceipt",
|
"apple.iap-verify-url=https://apple.invalid/verifyReceipt",
|
||||||
"apple.iap-verify-sandbox-url=https://apple-sandbox.invalid/verifyReceipt",
|
"apple.iap-verify-sandbox-url=https://apple-sandbox.invalid/verifyReceipt",
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:charge-service-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:charge-service-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE",
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE",
|
||||||
"apple.iap-verify-url=https://apple.invalid/verifyReceipt",
|
"apple.iap-verify-url=https://apple.invalid/verifyReceipt",
|
||||||
"apple.iap-verify-sandbox-url=https://apple-sandbox.invalid/verifyReceipt",
|
"apple.iap-verify-sandbox-url=https://apple-sandbox.invalid/verifyReceipt",
|
||||||
"payverse.host=https://payverse.invalid",
|
"payverse.host=https://payverse.invalid",
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:can-coupon-service-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:can-coupon-service-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:chat-banner-service-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:chat-banner-service-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ import java.time.LocalDateTime
|
|||||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||||
properties = [
|
properties = [
|
||||||
"spring.datasource.url=jdbc:h2:mem:notice-home-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:notice-home-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Import(AudioContentMainTabHomeServiceIntegrationTest.TimeConfiguration::class)
|
@Import(AudioContentMainTabHomeServiceIntegrationTest.TimeConfiguration::class)
|
||||||
|
|||||||
+11
-3
@@ -6,13 +6,13 @@ import kr.co.vividnext.sodalive.i18n.Lang
|
|||||||
import kr.co.vividnext.sodalive.member.Member
|
import kr.co.vividnext.sodalive.member.Member
|
||||||
import kr.co.vividnext.sodalive.member.MemberRole
|
import kr.co.vividnext.sodalive.member.MemberRole
|
||||||
import kr.co.vividnext.sodalive.support.EmbeddedRedisInitializer
|
import kr.co.vividnext.sodalive.support.EmbeddedRedisInitializer
|
||||||
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.boot.test.context.SpringBootTest
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
import org.springframework.data.domain.PageRequest
|
import org.springframework.data.domain.PageRequest
|
||||||
import org.springframework.test.annotation.DirtiesContext
|
|
||||||
import org.springframework.test.context.ContextConfiguration
|
import org.springframework.test.context.ContextConfiguration
|
||||||
import org.springframework.transaction.support.TransactionTemplate
|
import org.springframework.transaction.support.TransactionTemplate
|
||||||
import javax.persistence.EntityManager
|
import javax.persistence.EntityManager
|
||||||
@@ -21,16 +21,24 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:series-banner-service-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:series-banner-service-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
|
||||||
class ContentSeriesBannerServiceIntegrationTest @Autowired constructor(
|
class ContentSeriesBannerServiceIntegrationTest @Autowired constructor(
|
||||||
private val service: ContentSeriesBannerService,
|
private val service: ContentSeriesBannerService,
|
||||||
private val entityManager: EntityManager,
|
private val entityManager: EntityManager,
|
||||||
private val transactionTemplate: TransactionTemplate
|
private val transactionTemplate: TransactionTemplate
|
||||||
) {
|
) {
|
||||||
|
@AfterEach
|
||||||
|
fun removeFixtures() {
|
||||||
|
transactionTemplate.executeWithoutResult {
|
||||||
|
listOf("series_banner", "series", "series_genre", "member").forEach { table ->
|
||||||
|
entityManager.createNativeQuery("delete from $table").executeUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("OSIV off 환경에서 관리자 시리즈 배너 목록 응답 생성 시 lazy 초기화 예외가 발생하지 않는다")
|
@DisplayName("OSIV off 환경에서 관리자 시리즈 배너 목록 응답 생성 시 lazy 초기화 예외가 발생하지 않는다")
|
||||||
fun shouldCreateAdminSeriesBannerListResponseWhenOpenInViewIsDisabled() {
|
fun shouldCreateAdminSeriesBannerListResponseWhenOpenInViewIsDisabled() {
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ import org.springframework.test.context.ContextConfiguration
|
|||||||
"deployment.artifact-version=1.2.3-20260914",
|
"deployment.artifact-version=1.2.3-20260914",
|
||||||
"deployment.config-commit=1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d",
|
"deployment.config-commit=1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d",
|
||||||
"spring.datasource.url=jdbc:h2:mem:deployment-endpoint-injected-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:deployment-endpoint-injected-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ import org.springframework.test.context.ContextConfiguration
|
|||||||
properties = [
|
properties = [
|
||||||
"management.server.port=0",
|
"management.server.port=0",
|
||||||
"spring.datasource.url=jdbc:h2:mem:deployment-endpoint-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:deployment-endpoint-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ import java.time.LocalDateTime
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:event-banner-language-http;" +
|
"spring.datasource.url=jdbc:h2:mem:event-banner-language-http;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import java.time.LocalDateTime
|
|||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"cloud.aws.s3.bucket=test-bucket",
|
"cloud.aws.s3.bucket=test-bucket",
|
||||||
"spring.datasource.url=jdbc:h2:mem:event-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:event-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
package kr.co.vividnext.sodalive.i18n.translation
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
|
import org.junit.jupiter.api.DisplayName
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.springframework.test.annotation.DirtiesContext.HierarchyMode
|
||||||
|
import org.springframework.test.context.TestContextManager
|
||||||
|
|
||||||
|
class MetadataReadRetryContextIsolationTest {
|
||||||
|
@Test
|
||||||
|
@DisplayName("커뮤니티 테스트 context 생성과 종료는 원작 테스트 DB의 작업을 지우지 않는다")
|
||||||
|
fun shouldPreserveOriginalWorkJobsWhenCommunityContextCloses() {
|
||||||
|
val original = TestContextManager(OriginalWorkReadRetryTest::class.java).testContext
|
||||||
|
val community = TestContextManager(CreatorCommunityReadRetryTest::class.java).testContext
|
||||||
|
try {
|
||||||
|
val jobs = original.applicationContext.getBean(TranslationJobRepository::class.java)
|
||||||
|
val job = jobs.saveAndFlush(
|
||||||
|
TranslationJob(
|
||||||
|
resourceType = LanguageTranslationTargetType.ORIGINAL_WORK,
|
||||||
|
resourceId = 10L,
|
||||||
|
fieldKey = "title",
|
||||||
|
sourceHash = SourceTextNormalizer.hash("격리된 원작 제목"),
|
||||||
|
sourceText = "격리된 원작 제목",
|
||||||
|
sourceLanguage = "ko",
|
||||||
|
targetLanguage = "en"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
community.applicationContext.getBean(TranslationJobRepository::class.java)
|
||||||
|
} finally {
|
||||||
|
community.markApplicationContextDirty(HierarchyMode.CURRENT_LEVEL)
|
||||||
|
}
|
||||||
|
|
||||||
|
val preserved = jobs.findById(requireNotNull(job.id)).orElseThrow()
|
||||||
|
assertEquals("격리된 원작 제목", preserved.sourceText)
|
||||||
|
assertEquals(TranslationJobStatus.PENDING, preserved.status)
|
||||||
|
} finally {
|
||||||
|
original.markApplicationContextDirty(HierarchyMode.CURRENT_LEVEL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -23,7 +23,8 @@ import javax.persistence.EntityManager
|
|||||||
@DataJpaTest(
|
@DataJpaTest(
|
||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:metadata-read-retry;MODE=MySQL;NON_KEYWORDS=VALUE;DB_CLOSE_ON_EXIT=FALSE"
|
"spring.datasource.url=jdbc:h2:mem:metadata-read-retry-\${random.uuid};" +
|
||||||
|
"MODE=MySQL;NON_KEYWORDS=VALUE;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:live-reservation-service-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:live-reservation-service-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ import javax.persistence.LockModeType
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.datasource.url=jdbc:h2:mem:notice-concurrency;" +
|
"spring.datasource.url=jdbc:h2:mem:notice-concurrency;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;" +
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;" +
|
||||||
"DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=15000"
|
"DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=15000"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Import(ServiceNoticeConcurrencyIntegrationTest.TimeConfiguration::class)
|
@Import(ServiceNoticeConcurrencyIntegrationTest.TimeConfiguration::class)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import javax.persistence.EntityManager
|
|||||||
@SpringBootTest(
|
@SpringBootTest(
|
||||||
properties = [
|
properties = [
|
||||||
"spring.datasource.url=jdbc:h2:mem:notice-query-repository;" +
|
"spring.datasource.url=jdbc:h2:mem:notice-query-repository;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Import(ServiceNoticeQueryRepositoryTest.TimeConfiguration::class)
|
@Import(ServiceNoticeQueryRepositoryTest.TimeConfiguration::class)
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package kr.co.vividnext.sodalive.support
|
||||||
|
|
||||||
|
import com.zaxxer.hikari.HikariDataSource
|
||||||
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
|
import org.junit.jupiter.api.Assertions.assertNull
|
||||||
|
import org.junit.jupiter.api.Assertions.assertThrows
|
||||||
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
|
import org.junit.jupiter.api.DisplayName
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfigurations
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
|
||||||
|
import org.springframework.boot.env.RandomValuePropertySource
|
||||||
|
import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer
|
||||||
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner
|
||||||
|
import java.sql.DriverManager
|
||||||
|
import java.sql.SQLException
|
||||||
|
|
||||||
|
class H2DatabaseLifecycleTest {
|
||||||
|
@Test
|
||||||
|
@DisplayName("공용 테스트 H2는 풀 연결 사이에서 데이터를 공유하고 컨텍스트 종료 시 제거된다")
|
||||||
|
fun shouldShareDataAcrossPooledConnectionsAndRemoveDatabaseWhenContextCloses() {
|
||||||
|
lateinit var dataSource: HikariDataSource
|
||||||
|
ApplicationContextRunner()
|
||||||
|
.withInitializer { context ->
|
||||||
|
RandomValuePropertySource.addToEnvironment(context.environment)
|
||||||
|
ConfigDataApplicationContextInitializer().initialize(context)
|
||||||
|
}
|
||||||
|
.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration::class.java))
|
||||||
|
.run { context ->
|
||||||
|
assertNull(context.startupFailure)
|
||||||
|
dataSource = context.getBean(HikariDataSource::class.java)
|
||||||
|
dataSource.connection.use { first ->
|
||||||
|
first.createStatement().use { statement ->
|
||||||
|
statement.execute("CREATE TABLE lifecycle_marker (id INTEGER PRIMARY KEY)")
|
||||||
|
statement.executeUpdate("INSERT INTO lifecycle_marker (id) VALUES (1)")
|
||||||
|
}
|
||||||
|
dataSource.connection.use { second ->
|
||||||
|
second.createStatement().use { statement ->
|
||||||
|
statement.executeQuery("SELECT id FROM lifecycle_marker").use { rows ->
|
||||||
|
assertTrue(rows.next())
|
||||||
|
assertEquals(1, rows.getInt(1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(dataSource.isClosed)
|
||||||
|
val failure = assertThrows(SQLException::class.java) {
|
||||||
|
DriverManager.getConnection(
|
||||||
|
"${dataSource.jdbcUrl};IFEXISTS=TRUE",
|
||||||
|
dataSource.username,
|
||||||
|
dataSource.password
|
||||||
|
).use { connection ->
|
||||||
|
// Release a surviving database before the lifecycle assertion fails.
|
||||||
|
connection.createStatement().use { it.execute("SHUTDOWN") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertEquals(90146, failure.errorCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -112,7 +112,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:gift-admin-controller;MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;" +
|
"spring.datasource.url=jdbc:h2:mem:gift-admin-controller;MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;" +
|
||||||
"DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"jwt.secret=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==",
|
"jwt.secret=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-notice-http;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-notice-http;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Import(AdminNoticeControllerIntegrationTest.TimeConfiguration::class)
|
@Import(AdminNoticeControllerIntegrationTest.TimeConfiguration::class)
|
||||||
|
|||||||
+17
-2
@@ -13,6 +13,7 @@ import kr.co.vividnext.sodalive.support.EmbeddedRedisInitializer
|
|||||||
import org.hamcrest.Matchers.contains
|
import org.hamcrest.Matchers.contains
|
||||||
import org.hamcrest.Matchers.nullValue
|
import org.hamcrest.Matchers.nullValue
|
||||||
import org.hibernate.SessionFactory
|
import org.hibernate.SessionFactory
|
||||||
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@@ -20,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired
|
|||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
|
||||||
import org.springframework.boot.test.context.SpringBootTest
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
import org.springframework.jdbc.core.JdbcTemplate
|
import org.springframework.jdbc.core.JdbcTemplate
|
||||||
import org.springframework.test.annotation.DirtiesContext
|
|
||||||
import org.springframework.test.context.ContextConfiguration
|
import org.springframework.test.context.ContextConfiguration
|
||||||
import org.springframework.test.web.servlet.MockMvc
|
import org.springframework.test.web.servlet.MockMvc
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
|
||||||
@@ -40,13 +40,28 @@ import javax.persistence.EntityManager
|
|||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
|
||||||
class MainContentAllEndToEndTest @Autowired constructor(
|
class MainContentAllEndToEndTest @Autowired constructor(
|
||||||
private val mockMvc: MockMvc,
|
private val mockMvc: MockMvc,
|
||||||
private val entityManager: EntityManager,
|
private val entityManager: EntityManager,
|
||||||
private val transactionTemplate: TransactionTemplate,
|
private val transactionTemplate: TransactionTemplate,
|
||||||
private val jdbcTemplate: JdbcTemplate
|
private val jdbcTemplate: JdbcTemplate
|
||||||
) {
|
) {
|
||||||
|
@AfterEach
|
||||||
|
fun removeFixtures() {
|
||||||
|
transactionTemplate.executeWithoutResult {
|
||||||
|
listOf(
|
||||||
|
"orders",
|
||||||
|
"creator_localized_name",
|
||||||
|
"series_published_days_of_week",
|
||||||
|
"series",
|
||||||
|
"content",
|
||||||
|
"series_genre",
|
||||||
|
"content_theme",
|
||||||
|
"member"
|
||||||
|
).forEach { table -> jdbcTemplate.update("delete from $table") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("전체 콘텐츠 API는 JA 별칭을 우선하고 KO 별칭 미등록 시 일본어 원본을, 별칭 없는 작성자는 현재 원본을 반환한다")
|
@DisplayName("전체 콘텐츠 API는 JA 별칭을 우선하고 KO 별칭 미등록 시 일본어 원본을, 별칭 없는 작성자는 현재 원본을 반환한다")
|
||||||
fun shouldSelectLocalizedCreatorNamesWithoutChangingAudioTitles() {
|
fun shouldSelectLocalizedCreatorNamesWithoutChangingAudioTitles() {
|
||||||
|
|||||||
+21
-2
@@ -10,13 +10,13 @@ import kr.co.vividnext.sodalive.member.MemberRole
|
|||||||
import kr.co.vividnext.sodalive.support.EmbeddedRedisInitializer
|
import kr.co.vividnext.sodalive.support.EmbeddedRedisInitializer
|
||||||
import kr.co.vividnext.sodalive.v2.recommendation.adapter.out.persistence.RecommendationSnapshot
|
import kr.co.vividnext.sodalive.v2.recommendation.adapter.out.persistence.RecommendationSnapshot
|
||||||
import kr.co.vividnext.sodalive.v2.recommendation.domain.RecommendedSectionType
|
import kr.co.vividnext.sodalive.v2.recommendation.domain.RecommendedSectionType
|
||||||
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
|
||||||
import org.springframework.boot.test.context.SpringBootTest
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user
|
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user
|
||||||
import org.springframework.test.annotation.DirtiesContext
|
|
||||||
import org.springframework.test.context.ContextConfiguration
|
import org.springframework.test.context.ContextConfiguration
|
||||||
import org.springframework.test.web.servlet.MockMvc
|
import org.springframework.test.web.servlet.MockMvc
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
|
||||||
@@ -35,12 +35,27 @@ import javax.persistence.EntityManager
|
|||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
|
||||||
class ContentOverviewEndToEndTest @Autowired constructor(
|
class ContentOverviewEndToEndTest @Autowired constructor(
|
||||||
private val mockMvc: MockMvc,
|
private val mockMvc: MockMvc,
|
||||||
private val entityManager: EntityManager,
|
private val entityManager: EntityManager,
|
||||||
private val transactionTemplate: TransactionTemplate
|
private val transactionTemplate: TransactionTemplate
|
||||||
) {
|
) {
|
||||||
|
@AfterEach
|
||||||
|
fun removeFixtures() {
|
||||||
|
transactionTemplate.executeWithoutResult {
|
||||||
|
listOf(
|
||||||
|
"content_translation",
|
||||||
|
"recommendation_snapshot",
|
||||||
|
"content",
|
||||||
|
"content_theme",
|
||||||
|
"member_content_preference",
|
||||||
|
"member"
|
||||||
|
).forEach { table ->
|
||||||
|
entityManager.createNativeQuery("delete from $table").executeUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("콘텐츠 전체보기 API는 비회원 요청을 거부한다")
|
@DisplayName("콘텐츠 전체보기 API는 비회원 요청을 거부한다")
|
||||||
fun shouldRejectAnonymousContentOverviewRequest() {
|
fun shouldRejectAnonymousContentOverviewRequest() {
|
||||||
@@ -63,6 +78,7 @@ class ContentOverviewEndToEndTest @Autowired constructor(
|
|||||||
.andExpect(status().isOk)
|
.andExpect(status().isOk)
|
||||||
.andExpect(jsonPath("$.success").value(true))
|
.andExpect(jsonPath("$.success").value(true))
|
||||||
.andExpect(jsonPath("$.data.type").value("NEW_AND_HOT_AUDIO"))
|
.andExpect(jsonPath("$.data.type").value("NEW_AND_HOT_AUDIO"))
|
||||||
|
.andExpect(jsonPath("$.data.items.length()").value(1))
|
||||||
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
||||||
.andExpect(jsonPath("$.data.items[0].title").value("content-overview-new-hot-audio"))
|
.andExpect(jsonPath("$.data.items[0].title").value("content-overview-new-hot-audio"))
|
||||||
.andExpect(jsonPath("$.data.items[0].coverImage").value("https://cdn.test/content-overview-new-hot.png"))
|
.andExpect(jsonPath("$.data.items[0].coverImage").value("https://cdn.test/content-overview-new-hot.png"))
|
||||||
@@ -86,6 +102,7 @@ class ContentOverviewEndToEndTest @Autowired constructor(
|
|||||||
.andExpect(status().isOk)
|
.andExpect(status().isOk)
|
||||||
.andExpect(jsonPath("$.success").value(true))
|
.andExpect(jsonPath("$.success").value(true))
|
||||||
.andExpect(jsonPath("$.data.type").value("FIRST_AUDIO_CONTENT"))
|
.andExpect(jsonPath("$.data.type").value("FIRST_AUDIO_CONTENT"))
|
||||||
|
.andExpect(jsonPath("$.data.items.length()").value(1))
|
||||||
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
||||||
.andExpect(jsonPath("$.data.items[0].title").value("content-overview-first-audio"))
|
.andExpect(jsonPath("$.data.items[0].title").value("content-overview-first-audio"))
|
||||||
.andExpect(jsonPath("$.data.items[0].coverImage").value("https://cdn.test/content-overview-first.png"))
|
.andExpect(jsonPath("$.data.items[0].coverImage").value("https://cdn.test/content-overview-first.png"))
|
||||||
@@ -129,6 +146,7 @@ class ContentOverviewEndToEndTest @Autowired constructor(
|
|||||||
.with(user(MemberAdapter(fixture.viewer)))
|
.with(user(MemberAdapter(fixture.viewer)))
|
||||||
)
|
)
|
||||||
.andExpect(status().isOk)
|
.andExpect(status().isOk)
|
||||||
|
.andExpect(jsonPath("$.data.items.length()").value(1))
|
||||||
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
||||||
.andExpect(jsonPath("$.data.items[0].title").value(title))
|
.andExpect(jsonPath("$.data.items[0].title").value(title))
|
||||||
}
|
}
|
||||||
@@ -148,6 +166,7 @@ class ContentOverviewEndToEndTest @Autowired constructor(
|
|||||||
.andExpect(status().isOk)
|
.andExpect(status().isOk)
|
||||||
.andExpect(jsonPath("$.success").value(true))
|
.andExpect(jsonPath("$.success").value(true))
|
||||||
.andExpect(jsonPath("$.data.type").value("NEW_AND_HOT_AUDIO"))
|
.andExpect(jsonPath("$.data.type").value("NEW_AND_HOT_AUDIO"))
|
||||||
|
.andExpect(jsonPath("$.data.items.length()").value(1))
|
||||||
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
.andExpect(jsonPath("$.data.items[0].contentId").value(fixture.audioContentId))
|
||||||
.andExpect(jsonPath("$.data.page").value(0))
|
.andExpect(jsonPath("$.data.page").value(0))
|
||||||
.andExpect(jsonPath("$.data.size").value(20))
|
.andExpect(jsonPath("$.data.size").value(20))
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ import java.time.LocalDateTime
|
|||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"cloud.aws.s3.bucket=test-bucket",
|
"cloud.aws.s3.bucket=test-bucket",
|
||||||
"spring.datasource.url=jdbc:h2:mem:event-detail-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:event-detail-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ import java.time.LocalDateTime
|
|||||||
@SpringBootTest(
|
@SpringBootTest(
|
||||||
properties = [
|
properties = [
|
||||||
"spring.datasource.url=" +
|
"spring.datasource.url=" +
|
||||||
"jdbc:h2:mem:gift-controller;MODE=MySQL;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE",
|
"jdbc:h2:mem:gift-controller;MODE=MySQL;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE",
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test"
|
"cloud.aws.cloud-front.host=https://cdn.test"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"spring.datasource.url=jdbc:h2:mem:creator-ranking-controller;" +
|
"spring.datasource.url=jdbc:h2:mem:creator-ranking-controller;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
|||||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||||
properties = [
|
properties = [
|
||||||
"spring.datasource.url=jdbc:h2:mem:latest-notice-controller-integration;" +
|
"spring.datasource.url=jdbc:h2:mem:latest-notice-controller-integration;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ import javax.persistence.EntityManager
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:creator-ranking-aggregation;" +
|
"spring.datasource.url=jdbc:h2:mem:creator-ranking-aggregation;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Import(QueryDslConfig::class, DefaultCreatorRankingAggregationRepository::class)
|
@Import(QueryDslConfig::class, DefaultCreatorRankingAggregationRepository::class)
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ import java.time.LocalDateTime
|
|||||||
properties = [
|
properties = [
|
||||||
"spring.cache.type=none",
|
"spring.cache.type=none",
|
||||||
"spring.datasource.url=jdbc:h2:mem:creator-ranking-snapshot;" +
|
"spring.datasource.url=jdbc:h2:mem:creator-ranking-snapshot;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Import(QueryDslConfig::class, DefaultCreatorRankingSnapshotRepository::class)
|
@Import(QueryDslConfig::class, DefaultCreatorRankingSnapshotRepository::class)
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ import javax.persistence.EntityManager
|
|||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"cloud.aws.s3.bucket=test-bucket",
|
"cloud.aws.s3.bucket=test-bucket",
|
||||||
"spring.datasource.url=jdbc:h2:mem:admin-sub-banner-http;" +
|
"spring.datasource.url=jdbc:h2:mem:admin-sub-banner-http;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ import javax.persistence.EntityManager
|
|||||||
"cloud.aws.cloud-front.host=https://cdn.test",
|
"cloud.aws.cloud-front.host=https://cdn.test",
|
||||||
"cloud.aws.s3.bucket=test-bucket",
|
"cloud.aws.s3.bucket=test-bucket",
|
||||||
"spring.datasource.url=jdbc:h2:mem:public-sub-banner-http;" +
|
"spring.datasource.url=jdbc:h2:mem:public-sub-banner-http;" +
|
||||||
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"
|
"MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ spring:
|
|||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.h2.Driver
|
driver-class-name: org.h2.Driver
|
||||||
url: jdbc:h2:mem:sodalive-test-${random.uuid};MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
|
url: jdbc:h2:mem:sodalive-test-${random.uuid};MODE=MySQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=0;DB_CLOSE_ON_EXIT=FALSE
|
||||||
username: sa
|
username: sa
|
||||||
password:
|
password:
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ spring:
|
|||||||
ddl-auto: create-drop
|
ddl-auto: create-drop
|
||||||
properties:
|
properties:
|
||||||
hibernate:
|
hibernate:
|
||||||
show_sql: true
|
show_sql: false
|
||||||
format_sql: true
|
format_sql: false
|
||||||
cache:
|
cache:
|
||||||
type: redis
|
type: redis
|
||||||
|
|||||||
Reference in New Issue
Block a user