-
Notifications
You must be signed in to change notification settings - Fork 0
[REFACTOR] 가상 스레드 전환 및 k6 테스트 시나리오 재구성 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import http from 'k6/http'; | ||
| import { check } from 'k6'; | ||
|
|
||
| export const options = { | ||
| stages: [ | ||
| { duration: '10s', target: 50 }, // 워밍업 | ||
| { duration: '5s', target: 500 }, // 스파이크 (Tomcat 200 2.5배) | ||
| { duration: '20s', target: 500 }, // 스파이크 유지 | ||
| { duration: '5s', target: 0 }, // 종료 | ||
| ] | ||
| }; | ||
|
|
||
| export default function () { | ||
| const res = http.post( | ||
| `http://host.docker.internal:8081/test/notifications/trigger?userId=${__VU}`, | ||
| null, | ||
| { timeout: '10s' } | ||
| ); | ||
| check(res, { 'status 200': (r) => r.status === 200 }); | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.example.auctionnotification.notification.controller; | ||
|
|
||
| import com.example.auctionnotification.notification.dto.NotificationMessage; | ||
| import com.example.auctionnotification.notification.enums.NotificationType; | ||
| import com.example.auctionnotification.notification.service.NotificationService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.context.annotation.Profile; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RequestParam; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @Profile("!prod") | ||
| @RestController | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/test/notifications") | ||
| public class NotificationTestController { | ||
|
|
||
| private final NotificationService notificationService; | ||
|
|
||
| @PostMapping("/trigger") | ||
| public ResponseEntity<Void> trigger(@RequestParam(defaultValue = "1") Long userId) { | ||
| NotificationMessage message = new NotificationMessage( | ||
| NotificationType.NEW_BID, | ||
| userId, | ||
| 1L, | ||
| "테스트 경매 상품" | ||
| ); | ||
| notificationService.save(message); | ||
| return ResponseEntity.ok().build(); | ||
| } | ||
|
Comment on lines
+22
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 예외 처리를 추가하세요.
🛡️ 예외 처리 추가 제안 `@PostMapping`("/trigger")
public ResponseEntity<Void> trigger(`@RequestParam`(defaultValue = "1") Long userId) {
+ try {
NotificationMessage message = new NotificationMessage(
NotificationType.NEW_BID,
userId,
1L,
"테스트 경매 상품"
);
notificationService.save(message);
return ResponseEntity.ok().build();
+ } catch (Exception e) {
+ // 로그 기록 후 테스트를 위해 일관된 응답 반환
+ return ResponseEntity.status(500).build();
+ }
}🤖 Prompt for AI Agents
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 테스트용이라서 그냥 넘어갈게 테스트 결과 왜곡 없이 나오는거 확인했어 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
userId 유효성 검증을 고려하세요.
테스트 엔드포인트이지만 음수나 비정상적인 큰 값이 전달될 경우 예상치 못한 동작이 발생할 수 있습니다. 간단한 유효성 검증을 추가하는 것을 권장합니다.
✅ 유효성 검증 추가 제안
`@PostMapping`("/trigger") public ResponseEntity<Void> trigger(`@RequestParam`(defaultValue = "1") Long userId) { + if (userId == null || userId <= 0) { + return ResponseEntity.badRequest().build(); + } NotificationMessage message = new NotificationMessage(🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이것도 테스트용이라 넘어갈게
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soomin0209이해합니다! 테스트 전용 엔드포인트이고@Profile("!prod")로 프로덕션에서는 비활성화되어 있으니 괜찮습니다. 👍