From 9d447ca4417f253d1e228e0438ff2816eed40749 Mon Sep 17 00:00:00 2001 From: donghun1214 Date: Thu, 22 Aug 2024 07:13:31 +0000 Subject: [PATCH] feat(infra): add environment for load-test --- apps/backend/apps/client/src/user/user.service.ts | 12 ++++++------ .../codedang/container_definitions/admin_api.json | 13 +++++++++++++ .../codedang/container_definitions/client_api.json | 12 ++++++++++++ apps/infra/production/codedang/variables.tf | 3 +++ 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/apps/backend/apps/client/src/user/user.service.ts b/apps/backend/apps/client/src/user/user.service.ts index b55184642a..a47d48b7a0 100644 --- a/apps/backend/apps/client/src/user/user.service.ts +++ b/apps/backend/apps/client/src/user/user.service.ts @@ -81,7 +81,7 @@ export class UserService { async sendPinForRegisterNewEmail({ email }: UserEmailDto): Promise { // 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) } @@ -115,7 +115,7 @@ export class UserService { async createPinAndSendEmail(email: string): Promise { // 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' } @@ -219,7 +219,7 @@ export class UserService { email }: EmailAuthenticationPinDto): Promise { // 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) @@ -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) @@ -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 } diff --git a/apps/infra/production/codedang/container_definitions/admin_api.json b/apps/infra/production/codedang/container_definitions/admin_api.json index 31f7c5b145..2fc1f7af6a 100644 --- a/apps/infra/production/codedang/container_definitions/admin_api.json +++ b/apps/infra/production/codedang/container_definitions/admin_api.json @@ -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": { diff --git a/apps/infra/production/codedang/container_definitions/client_api.json b/apps/infra/production/codedang/container_definitions/client_api.json index 9a69015f95..b676f25783 100644 --- a/apps/infra/production/codedang/container_definitions/client_api.json +++ b/apps/infra/production/codedang/container_definitions/client_api.json @@ -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": { diff --git a/apps/infra/production/codedang/variables.tf b/apps/infra/production/codedang/variables.tf index 24c7e3799c..1bb3f6effa 100644 --- a/apps/infra/production/codedang/variables.tf +++ b/apps/infra/production/codedang/variables.tf @@ -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 }