Skip to content

Commit 545ef89

Browse files
committed
feat: use new actions for slo testing
1 parent 89f4332 commit 545ef89

File tree

12 files changed

+224
-143
lines changed

12 files changed

+224
-143
lines changed

.github/workflows/slo.yml

Lines changed: 69 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,88 @@
1-
name: SLO
1+
name: slo
2+
23
on:
34
pull_request:
45
branches:
56
- master
67
- release-*
78
workflow_dispatch:
9+
inputs:
10+
github_pull_request_number:
11+
required: true
12+
slo_workload_duration_seconds:
13+
default: '600'
14+
required: false
15+
slo_workload_read_max_rps:
16+
default: '1000'
17+
required: false
18+
slo_workload_write_max_rps:
19+
default: '100'
20+
required: false
21+
822
jobs:
9-
test-slo:
10-
concurrency:
11-
group: slo-${{ github.ref }}
23+
ydb-slo-action-init:
1224
if: (!contains(github.event.pull_request.labels.*.name, 'no slo'))
1325

26+
name: Run YDB SLO Tests
1427
runs-on: ubuntu-latest
15-
name: SLO test
16-
permissions:
17-
checks: write
18-
pull-requests: write
19-
contents: read
20-
issues: write
28+
29+
strategy:
30+
matrix:
31+
sdk:
32+
- id: database_sql
33+
name: database-sql
34+
path: ./database/sql
35+
label: database/sql
36+
- id: native_query
37+
name: native-query
38+
path: ./native/query
39+
label: native/query
40+
- id: native_table
41+
name: native-table
42+
path: ./native/table
43+
label: native/table
44+
- id: gorm
45+
name: gorm
46+
path: ./gorm
47+
label: gorm
48+
- id: xorm
49+
name: xorm
50+
path: ./xorm
51+
label: xorm
52+
53+
concurrency:
54+
group: slo-${{ github.ref }}-${{matrix.sdk.name}}
2155

2256
steps:
2357
- name: Checkout repository
2458
uses: actions/checkout@v4
2559

26-
- name: Run SLO
27-
uses: ydb-platform/slo-tests@main
28-
continue-on-error: true
60+
- name: Install Go
61+
uses: actions/setup-go@v5
2962
with:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
KUBECONFIG_B64: ${{ secrets.SLO_KUBE_CONFIG }}
32-
AWS_CREDENTIALS_B64: ${{ secrets.SLO_AWS_CREDENTIALS }}
33-
AWS_CONFIG_B64: ${{ secrets.SLO_AWS_CONFIG }}
34-
DOCKER_USERNAME: ${{ secrets.SLO_DOCKER_USERNAME }}
35-
DOCKER_PASSWORD: ${{ secrets.SLO_DOCKER_PASSWORD }}
36-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
37-
DOCKER_FOLDER: ${{ secrets.SLO_DOCKER_FOLDER }}
38-
s3_endpoint: ${{ secrets.SLO_S3_ENDPOINT }}
39-
s3_images_folder: ${{ vars.SLO_S3_IMAGES_FOLDER }}
40-
grafana_domain: ${{ vars.SLO_GRAFANA_DOMAIN }}
41-
grafana_dashboard: ${{ vars.SLO_GRAFANA_DASHBOARD }}
42-
ydb_version: 'newest'
43-
timeBetweenPhases: 30
44-
shutdownTime: 30
63+
go-version: 1.23.x
64+
cache: true
4565

46-
language_id0: 'native-table'
47-
workload_path0: 'tests/slo'
48-
language0: 'Native ydb-go-sdk/v3 over table-service'
49-
workload_build_context0: ../..
50-
workload_build_options0: -f Dockerfile --build-arg SRC_PATH=native/table --build-arg JOB_NAME=workload-native-table
66+
- name: Build workload
67+
run: |
68+
cd ./tests/slo
69+
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}}
70+
chmod +x .bin/${{matrix.sdk.id}}_linux_amd64
5171
52-
language_id1: 'database-sql'
53-
workload_path1: 'tests/slo'
54-
language1: 'Go SDK database/sql'
55-
workload_build_context1: ../..
56-
workload_build_options1: -f Dockerfile --build-arg SRC_PATH=database/sql --build-arg JOB_NAME=workload-database-sql
57-
58-
language_id2: 'gorm'
59-
workload_path2: 'tests/slo'
60-
language2: 'Go SDK gorm'
61-
workload_build_context2: ../..
62-
workload_build_options2: -f Dockerfile --build-arg SRC_PATH=gorm --build-arg JOB_NAME=workload-gorm
63-
64-
language_id3: 'xorm'
65-
workload_path3: 'tests/slo'
66-
language3: 'Go SDK xorm'
67-
workload_build_context3: ../..
68-
workload_build_options3: -f Dockerfile --build-arg SRC_PATH=xorm --build-arg JOB_NAME=workload-xorm
69-
70-
language_id4: 'native-query'
71-
workload_path4: 'tests/slo'
72-
language4: 'Native ydb-go-sdk/v3 over query-service'
73-
workload_build_context4: ../..
74-
workload_build_options4: -f Dockerfile --build-arg SRC_PATH=native/query --build-arg JOB_NAME=workload-native-query
75-
76-
- uses: actions/upload-artifact@v4
77-
if: always()
72+
- name: Inititialize YDB SLO
73+
uses: ydb-platform/ydb-slo-action/init@main
7874
with:
79-
name: slo-logs
80-
path: logs/
75+
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
76+
github_token: ${{ secrets.GITHUB_TOKEN }}
77+
sdk_name: ${{ matrix.sdk.name }}
78+
79+
- name: Run SLO Tests
80+
run: |
81+
./tests/slo/.bin/${{matrix.sdk.id}}_linux_amd64 create grpc://localhost:2135 /Root/testdb
82+
./tests/slo/.bin/${{matrix.sdk.id}}_linux_amd64 run grpc://localhost:2135 /Root/testdb \
83+
-prom-pgw localhost:9091 \
84+
-report-period 500 \
85+
-time ${{inputs.slo_workload_duration_seconds || 600}} \
86+
-read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \
87+
-write-rps ${{inputs.slo_workload_write_max_rps || 100}}
88+
./tests/slo/.bin/${{matrix.sdk.id}}_linux_amd64 cleanup grpc://localhost:2135 /Root/testdb

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ vendor
1717
changes.txt
1818
./internal/cmd/gtrace/gtrace
1919
examples/.golangci.yml
20-
tests/slo/.golangci.yml
20+
tests/slo/.golangci.yml
21+
tests/slo/.bin

tests/slo/database/sql/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
var (
21+
ref string
2122
label string
2223
jobName string
2324
)
@@ -95,7 +96,7 @@ func main() {
9596
case config.RunMode:
9697
gen := generator.New(cfg.InitialDataCount)
9798

98-
w, err := workers.New(cfg, s, label, jobName)
99+
w, err := workers.New(cfg, s, ref, label, jobName)
99100
if err != nil {
100101
panic(fmt.Errorf("create workers failed: %w", err))
101102
}

tests/slo/gorm/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
var (
21+
ref string
2122
label string
2223
jobName string
2324
)
@@ -95,7 +96,7 @@ func main() {
9596
case config.RunMode:
9697
gen := generator.New(cfg.InitialDataCount)
9798

98-
w, err := workers.New(cfg, s, label, jobName)
99+
w, err := workers.New(cfg, s, ref, label, jobName)
99100
if err != nil {
100101
panic(fmt.Errorf("create workers failed: %w", err))
101102
}

0 commit comments

Comments
 (0)