Skip to content

Commit

Permalink
feat(infra): add environment for load-test
Browse files Browse the repository at this point in the history
  • Loading branch information
donghun1214 committed Aug 22, 2024
1 parent 8f4c5c4 commit 9d447ca
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/backend/apps/client/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class UserService {

async sendPinForRegisterNewEmail({ email }: UserEmailDto): Promise<string> {
// TODO: load test를 위함, 테스트 후 삭제 예정
if (email === this.config.get('email_for_load_test')) {
if (email === this.config.get('EMAIL_FOR_LOAD_TEST')) {
this.logger.debug('load test - sendPinForRegisterNewEmail')
return this.createPinAndSendEmail(email)
}
Expand Down Expand Up @@ -115,7 +115,7 @@ export class UserService {

async createPinAndSendEmail(email: string): Promise<string> {
// TODO: load test를 위함, 테스트 후 삭제 예정
if (email === this.config.get('email_for_load_test')) {
if (email === this.config.get('EMAIL_FOR_LOAD_TEST')) {
this.logger.debug('load test - createPinAndSendEmail')
return 'You entered an email for testing'
}
Expand Down Expand Up @@ -219,7 +219,7 @@ export class UserService {
email
}: EmailAuthenticationPinDto): Promise<string> {
// TODO: load test를 위함, 테스트 후 삭제 예정
if (pin === this.config.get('pin_for_load_test')) {
if (pin === this.config.get('PIN_FOR_LOAD_TEST')) {
this.logger.debug('load test - verifyPinAndIssueJwt')
const payload: EmailAuthJwtPayload = { email }
const token = await this.createJwt(payload)
Expand Down Expand Up @@ -324,8 +324,8 @@ export class UserService {
async signUp(req: Request, signUpDto: SignUpDto) {
// TODO: load test를 위함, 테스트 후 삭제 예정
if (
signUpDto.email === this.config.get('email_for_load_test') ||
signUpDto.username === this.config.get('username_for_load_test')
signUpDto.email === this.config.get('EMAIL_FOR_LOAD_TEST') ||
signUpDto.username === this.config.get('USERNAME_FOR_LOAD_TEST')
) {
this.logger.debug('load test - sign up')
return await this.signUpForLoadTest(signUpDto)
Expand Down Expand Up @@ -637,7 +637,7 @@ export class UserService {

async checkDuplicatedUsername(usernameDto: UsernameDto) {
// TODO: load test를 위함, 테스트 후 삭제 예정
if (usernameDto.username === this.config.get('username_for_load_test')) {
if (usernameDto.username === this.config.get('USERNAME_FOR_LOAD_TEST')) {
this.logger.debug('load test - checkDuplicatedUsername')
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
{
"name": "OTEL_EXPORTER_OTLP_ENDPOINT_URL",
"value": "${otel_exporter_otlp_endpoint_url}"
},

{
"name": "USERNAME_FOR_LOAD_TEST",
"value": "${usernmae_for_load_test}"
},
{
"name": "EMAIL_FOR_LOAD_TEST",
"value": "${email_for_load_test}"
},
{
"name": "PIN_FOR_LOAD_TEST",
"value": "${pin_for_load_test}"
}
],
"logConfiguration": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@
{
"name": "OTEL_EXPORTER_OTLP_ENDPOINT_URL",
"value": "${otel_exporter_otlp_endpoint_url}"
},
{
"name": "USERNAME_FOR_LOAD_TEST",
"value": "${usernmae_for_load_test}"
},
{
"name": "EMAIL_FOR_LOAD_TEST",
"value": "${email_for_load_test}"
},
{
"name": "PIN_FOR_LOAD_TEST",
"value": "${pin_for_load_test}"
}
],
"logConfiguration": {
Expand Down
3 changes: 3 additions & 0 deletions apps/infra/production/codedang/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ variable "kakao_client_id" { sensitive = true }
variable "kakao_client_secret" { sensitive = true }
variable "otel_exporter_otlp_endpoint_url" { sensitive = true }
variable "loki_url" { sensitive = true }
variable "username_for_load_test" { sensitive = true }
variable "email_for_load_test" { sensitive = true }
variable "pin_for_load_test" { sensitive = true }

variable "testcase_bucket_name" { sensitive = true }
variable "testcase_access_key" { sensitive = true }
Expand Down

0 comments on commit 9d447ca

Please sign in to comment.