Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ jobs:
- name: Run Tests
run: |
if [ "${{ github.base_ref }}" == "main" ]; then
./gradlew allTests
./gradlew unitTest
./gradlew integrationTest
else
./gradlew allTests
./gradlew unitTest
./gradlew integrationTest
./gradlew e2eTest
fi
working-directory: apps/user-service

Expand Down
23 changes: 14 additions & 9 deletions apps/user-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,26 @@ ext {
snippetsDir = file('build/generated-snippets')
}

tasks.named('test') {
tasks.register('unitTest', Test) {
outputs.dir snippetsDir
useJUnitPlatform {
// 기본적으로는 e2e 태그 제외하고 실행
excludeTags 'e2e'
includeTags 'unit'
}

systemProperty 'spring.profiles.active', 'test-unit'
}

tasks.register('integrationTest', Test) {
outputs.dir snippetsDir
useJUnitPlatform {
includeTags 'integration'
}

systemProperty 'spring.profiles.active', 'test-integration'

timeout = Duration.ofMinutes(10)
}

// E2E 테스트 전용 task 추가
tasks.register('e2eTest', Test) {
outputs.dir snippetsDir
Expand All @@ -113,12 +124,6 @@ tasks.register('e2eTest', Test) {
timeout = Duration.ofMinutes(10)
}

// 모든 테스트 실행 task
tasks.register('allTests', Test) {
outputs.dir snippetsDir
useJUnitPlatform()
}

// AsciiDoctor 설정 (REST Docs 문서 생성)
asciidoctor {
inputs.dir snippetsDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import lombok.extern.slf4j.Slf4j;

@Service
@Profile({"test-unit", "test-e2e", "local", "develop"})
@Profile({"test-unit", "test-e2e", "test-integration", "local", "develop"})
@Slf4j
public class MockEmailService implements EmailService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spring:
password:
driver-class-name: org.h2.Driver
hikari:
connection-init-sql: "SET MODE MariaDB"
connection-init-sql: "SET MODE MariaDB; SET NON_KEYWORDS USER;"
connection-timeout: 30000
idle-timeout: 600000
max-lifetime: 1800000
Expand All @@ -23,15 +23,6 @@ spring:
console:
enabled: true

# JPA 설정 (H2용)
jpa:
hibernate:
ddl-auto: create-drop
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect

# SQL 스크립트 초기화 설정
sql:
init:
Expand All @@ -48,4 +39,4 @@ mybatis:
map-underscore-to-camel-case: true

logging:
config: classpath:log4j2-test-unit.yml
config: classpath:log4j2-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ spring:
console:
enabled: true

# JPA 설정 (H2용)
jpa:
hibernate:
ddl-auto: create-drop
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect

# SQL 스크립트 초기화 설정
sql:
init:
Expand Down
4 changes: 4 additions & 0 deletions apps/user-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ spring:
name: mvp
profiles:
active: develop
test:
context:
cache:
maxSize: 1
mybatis:
# Mapper XML 파일 위치
mapper-locations: classpath:mapper/**/*.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.gltkorea.icebang.e2e.scenario;

import org.junit.jupiter.api.Test;

import com.gltkorea.icebang.e2e.setup.support.E2eTestSupport;

class ContextLoadE2eTests extends E2eTestSupport {

@Test
void contextLoads() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.springframework.http.*;
import org.springframework.test.context.jdbc.Sql;

import com.gltkorea.icebang.e2e.support.E2eTestSupport;
import com.gltkorea.icebang.e2e.setup.support.E2eTestSupport;

@Sql(
value = "classpath:sql/01-insert-internal-users.sql",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gltkorea.icebang.e2e.annotation;
package com.gltkorea.icebang.e2e.setup.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gltkorea.icebang.e2e.config;
package com.gltkorea.icebang.e2e.setup.config;

import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gltkorea.icebang.e2e.support;
package com.gltkorea.icebang.e2e.setup.support;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -9,8 +9,8 @@
import org.springframework.web.context.WebApplicationContext;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;

import com.gltkorea.icebang.e2e.annotation.E2eTest;
import com.gltkorea.icebang.e2e.config.E2eTestConfiguration;
import com.gltkorea.icebang.e2e.setup.annotation.E2eTest;
import com.gltkorea.icebang.e2e.setup.config.E2eTestConfiguration;

@Import(E2eTestConfiguration.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gltkorea.icebang.e2e.support;
package com.gltkorea.icebang.e2e.setup.support;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Loading
Loading