Add Chaos Testing Step #2700
Workflow file for this run
This file contains 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
name: slo | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
- release-* | |
workflow_dispatch: | |
inputs: | |
github_pull_request_number: | |
required: true | |
slo_workload_duration_seconds: | |
default: '180' | |
required: false | |
slo_workload_read_max_rps: | |
default: '1000' | |
required: false | |
slo_workload_write_max_rps: | |
default: '100' | |
required: false | |
jobs: | |
ydb-slo-action-init: | |
if: (!contains(github.event.pull_request.labels.*.name, 'no slo')) | |
name: Run YDB SLO Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
sdk: | |
- id: database_sql | |
name: database-sql | |
path: ./database/sql | |
label: database/sql | |
- id: native_query | |
name: native-query | |
path: ./native/query | |
label: native/query | |
- id: native_table | |
name: native-table | |
path: ./native/table | |
label: native/table | |
- id: gorm | |
name: gorm | |
path: ./gorm | |
label: gorm | |
- id: xorm | |
name: xorm | |
path: ./xorm | |
label: xorm | |
concurrency: | |
group: slo-${{ github.ref }}-${{ matrix.sdk.name }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
cache: true | |
- name: Build workload | |
run: | | |
cd ./tests/slo | |
go build -o .bin/${{matrix.sdk.id}}_linux_amd64 -ldflags "-X \"main.ref=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}\" -X \"main.label=${{matrix.sdk.label}}\" -X \"main.jobName=${{matrix.sdk.name}}\"" ${{matrix.sdk.path}} | |
chmod +x .bin/${{matrix.sdk.id}}_linux_amd64 | |
- name: Inititialize YDB SLO | |
uses: ydb-platform/ydb-slo-action/init@main | |
with: | |
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
sdk_name: ${{ matrix.sdk.name }} | |
- name: Prepare SLO Database | |
run: | | |
./tests/slo/.bin/${{matrix.sdk.id}}_linux_amd64 create grpc://localhost:2135 /Root/testdb | |
- name: Chaos YDB | |
run: | | |
curl -L https://github.com/alexei-led/pumba/releases/download/0.10.1/pumba_linux_amd64 -o /tmp/pumba | |
chmod +x /tmp/pumba | |
/tmp/pumba --random --interval 30s restart --timeout 30s re2:^ydb-dynamic & | |
# - name: Chaos Network | |
# run: | | |
# sudo tc qdisc add dev lo root netem delay 100ms 50ms loss 5% corrupt 1% | |
- name: Run SLO Tests | |
run: | | |
./tests/slo/.bin/${{matrix.sdk.id}}_linux_amd64 run grpc://localhost:2135 /Root/testdb \ | |
-prom-pgw localhost:9091 \ | |
-report-period 250 \ | |
-time ${{inputs.slo_workload_duration_seconds || 60}} \ | |
-read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \ | |
-write-rps ${{inputs.slo_workload_write_max_rps || 100}} \ | |
-read-timeout 1000 \ | |
-write-timeout 1000 || true | |
# - if: always() | |
# run: | | |
# sudo tc qdisc del dev lo root | |
- name: Cleanup SLO Database | |
run: | | |
./tests/slo/.bin/${{matrix.sdk.id}}_linux_amd64 cleanup grpc://localhost:2135 /Root/testdb || true |