-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 부하 테스트 자동화 구성 #31
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
Open
lsy1307
wants to merge
16
commits into
main
Choose a base branch
from
19-feat-loadtest-rds-parameter-store
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a253665
chore: 부하 테스트 secret 포인터 갱신
lsy1307 d7456ec
feat: 부하 테스트 RDS 인프라 구성
lsy1307 95da845
feat: 부하 테스트 실행 스크립트 추가
lsy1307 bdfb439
feat: 부하 테스트 GitHub Actions 실행 추가
lsy1307 9ef254a
feat: stage 생성 시 k6 파일 배치 추가
lsy1307 7d59011
fix: 부하 테스트 자동화 리뷰 반영
lsy1307 4878107
chore: 부하 테스트 plan 자동 검증 제외
lsy1307 4ebeb6c
feat: k6 전용 부하 생성 EC2 구성
lsy1307 c8a70cc
feat: EC2 기반 k6 실행 workflow 추가
lsy1307 b097ca9
fix: k6 실행 설정과 응답 검증 보강
lsy1307 4ad54c4
docs: EC2 기반 부하 테스트 절차 정리
lsy1307 628043a
feat: k6 응답 검증 보강
lsy1307 6f2247a
feat: RDS 스냅샷 기반 부하 테스트 구성
lsy1307 f6e3174
feat: 부하 테스트 시크릿 참조 갱신
lsy1307 ab1135c
feat: 레거시 부하 테스트 스크립트 제거
lsy1307 ea86883
feat: 부하 테스트 리뷰 항목 정리
lsy1307 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: Load Test Run | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| vus: | ||
| description: "k6 VUs" | ||
| required: true | ||
| default: "10" | ||
| type: string | ||
| iterations: | ||
| description: "k6 iterations per VU" | ||
| required: true | ||
| default: "10" | ||
| type: string | ||
| max_duration: | ||
| description: "k6 max duration" | ||
| required: true | ||
| default: "15m" | ||
| type: string | ||
| target_base_url: | ||
| description: "Target base URL. Empty uses Terraform default." | ||
| required: false | ||
| default: "" | ||
| type: string | ||
| prometheus_remote_write_url: | ||
| description: "Prometheus remote-write URL. Empty uses Terraform default." | ||
| required: false | ||
| default: "" | ||
| type: string | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: load-test-environment | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| TF_VERSION: "1.10.5" | ||
|
|
||
| jobs: | ||
| run: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| token: ${{ secrets.GH_PAT }} | ||
| persist-credentials: false | ||
|
|
||
| - uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ vars.AWS_LOAD_TEST_ROLE_ARN }} | ||
| aws-region: ap-northeast-2 | ||
|
|
||
| - uses: hashicorp/setup-terraform@v3 | ||
| with: | ||
| terraform_version: ${{ env.TF_VERSION }} | ||
| terraform_wrapper: false | ||
|
|
||
| - name: Install jq | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y jq | ||
|
|
||
| - name: Run k6 on load generator | ||
| env: | ||
| VUS: ${{ inputs.vus }} | ||
| ITERATIONS: ${{ inputs.iterations }} | ||
| MAX_DURATION: ${{ inputs.max_duration }} | ||
| TARGET_BASE_URL: ${{ inputs.target_base_url }} | ||
| PROMETHEUS_REMOTE_WRITE_URL: ${{ inputs.prometheus_remote_write_url }} | ||
| run: | | ||
| args=( | ||
| --vus "$VUS" | ||
| --iterations "$ITERATIONS" | ||
| --max-duration "$MAX_DURATION" | ||
| ) | ||
|
|
||
| if [ -n "$TARGET_BASE_URL" ]; then | ||
| args+=(--target-base-url "$TARGET_BASE_URL") | ||
| fi | ||
|
|
||
| if [ -n "$PROMETHEUS_REMOTE_WRITE_URL" ]; then | ||
| args+=(--prometheus-remote-write-url "$PROMETHEUS_REMOTE_WRITE_URL") | ||
| fi | ||
|
|
||
| bash scripts/load_test/run_k6.sh "${args[@]}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Load Test Start | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| switch_stage_to_loadtest: | ||
| description: "Restart stage app with dev,loadtest profiles" | ||
| required: true | ||
| default: true | ||
| type: boolean | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: load-test-environment | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| TF_VERSION: "1.10.5" | ||
|
|
||
| jobs: | ||
| start: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| token: ${{ secrets.GH_PAT }} | ||
| persist-credentials: false | ||
|
|
||
| - uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ vars.AWS_LOAD_TEST_ROLE_ARN }} | ||
| aws-region: ap-northeast-2 | ||
|
|
||
| - uses: hashicorp/setup-terraform@v3 | ||
| with: | ||
| terraform_version: ${{ env.TF_VERSION }} | ||
| terraform_wrapper: false | ||
|
|
||
| - name: Install jq | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y jq | ||
|
|
||
| - name: Start load test environment | ||
| run: | | ||
| export TF_VAR_load_generator_instance_type="c7i.large" | ||
|
|
||
| if [ -n "${{ vars.LOAD_GENERATOR_INSTANCE_PROFILE_NAME }}" ]; then | ||
| export TF_VAR_load_generator_instance_profile_name="${{ vars.LOAD_GENERATOR_INSTANCE_PROFILE_NAME }}" | ||
| fi | ||
|
|
||
| args=() | ||
|
|
||
| if [ "${{ inputs.switch_stage_to_loadtest }}" = "true" ]; then | ||
| args+=(--switch-stage-to-loadtest) | ||
| fi | ||
|
|
||
| bash scripts/load_test/start.sh "${args[@]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: Load Test Stop | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| restore_stage_dev: | ||
| description: "Restart stage app with dev profile" | ||
| required: true | ||
| default: true | ||
| type: boolean | ||
| destroy_rds: | ||
| description: "Destroy load test Terraform stack" | ||
| required: true | ||
| default: true | ||
| type: boolean | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: load-test-environment | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| TF_VERSION: "1.10.5" | ||
|
|
||
| jobs: | ||
| stop: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| token: ${{ secrets.GH_PAT }} | ||
| persist-credentials: false | ||
|
|
||
| - uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ vars.AWS_LOAD_TEST_ROLE_ARN }} | ||
| aws-region: ap-northeast-2 | ||
|
|
||
| - uses: hashicorp/setup-terraform@v3 | ||
| with: | ||
| terraform_version: ${{ env.TF_VERSION }} | ||
| terraform_wrapper: false | ||
|
|
||
| - name: Install jq | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y jq | ||
|
|
||
| - name: Stop load test environment | ||
| run: | | ||
| args=() | ||
|
|
||
| if [ "${{ inputs.restore_stage_dev }}" = "true" ]; then | ||
| args+=(--restore-stage-dev) | ||
| fi | ||
|
|
||
| if [ "${{ inputs.destroy_rds }}" != "true" ]; then | ||
| args+=(--skip-terraform-destroy) | ||
| fi | ||
|
|
||
| bash scripts/load_test/stop.sh "${args[@]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "boardCode": "FREE", | ||
| "postCategory": "자유", | ||
| "title": "수강신청 어떻게 하나요?", | ||
| "content": "수강신청 방법을 잘 모르겠어요.", | ||
| "isQuestion": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| trap 'echo "xk6 setup failed" >&2' ERR | ||
|
|
||
| export GO_VERSION=1.25.9 | ||
| export XK6_VERSION=v1.4.3 | ||
| export XK6_PROMETHEUS_REMOTE_VERSION=v0.5.1 | ||
| export BASE_DIR=/home/ubuntu/solid-connection-load-test/k6 | ||
| export GOROOT=${BASE_DIR}/go | ||
| export GOPATH=${BASE_DIR}/go-workspace | ||
| export PATH=$PATH:$GOROOT/bin:$GOPATH/bin | ||
| export XK6_BIN=${GOPATH}/bin/xk6 | ||
| export K6_OUT=experimental-prometheus-rw | ||
| export K6_PROMETHEUS_RW_SERVER_URL=${K6_PROMETHEUS_RW_SERVER_URL:-} | ||
| export K6_PROMETHEUS_RW_TREND_STATS="${K6_PROMETHEUS_RW_TREND_STATS:-p(90),p(95),p(99),avg,min,max}" | ||
|
|
||
| { | ||
| echo "export BASE_DIR=${BASE_DIR}" | ||
| echo "export GOROOT=${GOROOT}" | ||
| echo "export GOPATH=${GOPATH}" | ||
| echo "export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin" | ||
| echo "export XK6_BIN=${GOPATH}/bin/xk6" | ||
| echo "export K6_OUT=experimental-prometheus-rw" | ||
| echo "export K6_PROMETHEUS_RW_SERVER_URL=${K6_PROMETHEUS_RW_SERVER_URL}" | ||
| echo "export K6_PROMETHEUS_RW_TREND_STATS=\"${K6_PROMETHEUS_RW_TREND_STATS}\"" | ||
| } >> ~/.bashrc | ||
|
|
||
| echo "Create and enter ${BASE_DIR}" | ||
| mkdir -p "$BASE_DIR" | ||
| cd "$BASE_DIR" | ||
|
|
||
| echo "Download Go ${GO_VERSION}" | ||
| curl -OL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | ||
|
|
||
| echo "Extract Go" | ||
| tar -xzf "go${GO_VERSION}.linux-amd64.tar.gz" | ||
| rm "go${GO_VERSION}.linux-amd64.tar.gz" | ||
|
|
||
| echo "Go version: $(go version)" | ||
|
|
||
| echo "Install xk6" | ||
| go install "go.k6.io/xk6/cmd/xk6@${XK6_VERSION}" | ||
|
|
||
| echo "xk6 installed: ${XK6_BIN}" | ||
| "$XK6_BIN" --help > /dev/null && echo "xk6 executable is available" | ||
|
|
||
| echo "Build k6 with Prometheus remote-write output" | ||
| "$XK6_BIN" build --with "github.com/grafana/xk6-output-prometheus-remote@${XK6_PROMETHEUS_REMOTE_VERSION}" | ||
|
|
||
| echo "Build complete: $(pwd)/k6" | ||
| ls -lh ./k6 | ||
|
|
||
| echo "xk6 setup completed" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "postCategory": "자유", | ||
| "title": "수강신청 어떻게 하나요?", | ||
| "content": "수강신청 방법을 잘 알겠어요." | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.