Skip to content

Commit

Permalink
MATE-129 : [FEAT] 배포환경에서의 크롤링 테스트를 위한 스케쥴러 시간 조정 (#118)
Browse files Browse the repository at this point in the history
* MATE-129 : [TEST] 배포환경에서의 크롤링 테스트
- 1. 자동 크롤링 시간 임시 조정 오전 9시에서 매시 30분으로 조정

* MATE-129 : [TEST] 환경변수 테스트용 더미값 설정

* MATE-129 : [TEST] @MockBean 제거
- 1. 기존 로컬 환경에서의 프로파일 설정을 common으로 변경 후 해당 문제상황 해결

* MATE-129 : [TEST] properties 설정 임의로 제거

* MATE-129 : [FEAT] @MockBean JwtUtil 추가

* MATE-129 : [TEST] deploy.yml 테스트
- 1. 기존 최상단 MateApplicationTests가 profile 설정을 제거 후 깃헙 액션에서 통과되는지 확인

* MATE-129 : [TEST] deploy.yml 수정
- 1. develop 브랜치에 합병했을 때 deploy되도록 수정
  • Loading branch information
juchan204 authored Dec 31, 2024
1 parent 2a7606d commit 28066a2
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public ResponseEntity<ApiResponse<CrawlingStatusResponse>> crawlMatchesByDate(
//테스트
@PostMapping("/matches/custom")
public ResponseEntity<CrawlingStatusResponse> crawlCustomDateMatches() {
// 9월로 가정하고 크롤링
LocalDate customDate = LocalDate.of(2024, 9, 1);
// 3월로 가정하고 크롤링
LocalDate customDate = LocalDate.of(2025, 3, 1);
return ResponseEntity.ok(crawlingService.crawlMatchesFromCustomDate(customDate));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
public class CrawlingScheduler {
private final CrawlingService crawlingService;

@Scheduled(cron = "0 0 9 * * *", zone = "Asia/Seoul")
// 매시 30분
@Scheduled(cron = "0 30 * * * *", zone = "Asia/Seoul")
public void morningUpdate() {
log.info("Starting morning schedule update");
try {
Expand Down Expand Up @@ -43,7 +44,7 @@ public void eveningUpdate() {
}
}

// 매 분 실행 자동화 테스트 (현재 off-season )
// // 매 분 실행 자동화 테스트 (현재 off-season )
// @Scheduled(cron = "0 * * * * *", zone = "Asia/Seoul")
// public void testScheduler() {
// log.info("Test Scheduler is running!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public CrawlingStatusResponse crawlAllCurrentMatches() {

try {
webDriver = webDriverFactory.getObject();
LocalDate now = LocalDate.now();
LocalDate now = LocalDate.now().withYear(2025).withMonth(3); // 2025년 3월로 설정

// 현재 월과 다음 달의 데이터 크롤링
for (int monthOffset = 0; monthOffset < 2; monthOffset++) {
Expand Down
8 changes: 1 addition & 7 deletions src/test/java/com/example/mate/MateApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest(properties = {
"jwt.secret_key=testsecretkey12345678901234567890",
"oauth.naver.client-id=test_client_id",
"oauth.naver.redirect-uri=http://localhost:8080/callback",
"oauth.naver.client-secret=test_client_secret",
"openweather.api.key=test_api_key"
})
@SpringBootTest
@EnableConfigurationProperties(OAuthConfig.class)
class MateApplicationTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class NaverAuthIntegrationTest {
@Autowired
private RestTemplate restTemplate;

@MockBean
private JwtUtil jwtUtil;

@BeforeEach
void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public class GoodsChatIntegrationTest {
@Autowired private ObjectMapper objectMapper;
@Autowired private JdbcTemplate jdbcTemplate;

@MockBean
private JwtUtil jwtUtil;

private Member seller;
private Member buyer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ public class GoodsPostIntegrationTest {
private Member member;
private GoodsPost goodsPost;

@MockBean
private JwtUtil jwtUtil;

@BeforeEach
void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class MatchIntegrationTest {
@Autowired
private ObjectMapper objectMapper;

@MockBean
private JwtUtil jwtUtil;

@BeforeEach
void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ void setUp() {
teamRecordRepository.deleteAll();
}

@MockBean
private JwtUtil jwtUtil;

@Nested
@DisplayName("팀 순위 조회")
class GetTeamRankings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ public class MateIntegrationTest {
@Autowired
private JdbcTemplate jdbcTemplate;

@MockBean
private JwtUtil jwtUtil;

// 테스트에서 공통으로 사용할 객체들
private Member testMember;
private Match futureMatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ public class MateStatusIntegrationTest {
private MatePost completedPost;
private MatePost closedPost;

@MockBean
private JwtUtil jwtUtil;

@BeforeEach
void setUp() {
// 기존 데이터 정리
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.example.mate.common.config.S3Config;
import com.example.mate.common.error.ErrorCode;
import com.example.mate.config.WithAuthMember;
import com.example.mate.common.security.util.JwtUtil;
import com.example.mate.domain.constant.Gender;
import com.example.mate.domain.file.FileService;
import com.example.mate.domain.member.entity.Follow;
import com.example.mate.domain.member.entity.Member;
import com.example.mate.domain.member.repository.FollowRepository;
Expand Down Expand Up @@ -44,9 +46,6 @@ public class FollowIntegrationTest {
@Autowired
private MemberRepository memberRepository;

@MockBean
private JwtUtil jwtUtil;

@Autowired
private JdbcTemplate jdbcTemplate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private MemberInfoUpdateRequest createMemberInfoUpdateRequest() {
.memberId(member.getId())
.build();
}

@Nested
@DisplayName("자체 회원 가입")
class Join {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ public class ProfileIntegrationTest {
@Autowired
private ObjectMapper objectMapper;

@MockBean
private JwtUtil jwtUtil;

private Member member1;
private Member member2;
private Member member3;
Expand Down

0 comments on commit 28066a2

Please sign in to comment.