Skip to content

Commit 72cace2

Browse files
committed
Added CI workflow
1 parent e8d6d82 commit 72cace2

File tree

6 files changed

+113
-12
lines changed

6 files changed

+113
-12
lines changed

.github/workflows/slo.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: SLO
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
github_pull_request_number:
7+
required: true
8+
slo_workload_duration_seconds:
9+
default: '600'
10+
required: false
11+
slo_workload_read_max_rps:
12+
default: '1000'
13+
required: false
14+
slo_workload_write_max_rps:
15+
default: '100'
16+
required: false
17+
18+
jobs:
19+
ydb-slo-action:
20+
name: Run YDB SLO Tests
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
matrix:
25+
include:
26+
- workload: table
27+
connection-string: grpc://localhost:2135/?database=/Root/testdb
28+
run-args: |
29+
--metrics-push-url http://localhost:9090/api/v1/otlp/v1/metrics \
30+
--time ${{inputs.slo_workload_duration_seconds || 600}} \
31+
--read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \
32+
--write-rps ${{inputs.slo_workload_write_max_rps || 100}} \
33+
--read-timeout 1000 \
34+
--write-timeout 1000
35+
group: slo-${{ github.ref }}
36+
cancel-in-progress: true
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ inputs.commit_sha }}
43+
fetch-depth: 0
44+
45+
- name: Configure git
46+
uses: ./.github/actions/configure_git
47+
48+
- name: Build SLO Workload Binary
49+
run: |
50+
./ya make ydb/public/sdk/cpp/tests/slo_workloads/key_value -r
51+
52+
- name: Initialize YDB SLO
53+
uses: ydb-platform/ydb-slo-action/init@main
54+
with:
55+
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
workload_name: ${{ matrix.workload }}
58+
ydb_database_node_count: 5
59+
60+
- name: Prepare SLO Database
61+
run: |
62+
./ydb/public/sdk/cpp/tests/slo_workloads/key_value/key_value ${{ matrix.connection-string }} create
63+
64+
- name: Run SLO Tests
65+
run: |
66+
./ydb/public/sdk/cpp/tests/slo_workloads/key_value/key_value ${{ matrix.connection-string }} run ${{ matrix.run-args }}
67+
68+
- if: always()
69+
name: Store ydb chaos testing logs
70+
run: |
71+
docker logs ydb-chaos > chaos-ydb.log
72+
73+
- if: always()
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: ${{ matrix.workload }}-chaos-ydb.log
77+
path: ./chaos-ydb.log
78+
retention-days: 1
79+
80+
- if: always()
81+
name: Cleanup SLO Database
82+
run: |
83+
./ydb/public/sdk/cpp/tests/slo_workloads/key_value/key_value ${{ matrix.connection-string }} cleanup

.github/workflows/slo_report.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: SLO Report
2+
3+
on:
4+
workflow_run:
5+
workflows: ['SLO']
6+
types:
7+
- completed
8+
9+
jobs:
10+
test-ydb-slo-action:
11+
runs-on: ubuntu-latest
12+
name: Publish YDB SLO Report
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
if: github.event.workflow_run.conclusion == 'success'
17+
steps:
18+
- name: Publish YDB SLO Report
19+
uses: ydb-platform/ydb-slo-action/report@main
20+
with:
21+
github_run_id: ${{ github.event.workflow_run.id }}
22+
github_token: ${{ secrets.GITHUB_TOKEN }}

ydb/public/sdk/cpp/tests/slo_workloads/key_value/key_value.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ int DoRun(TDatabaseOptions& dbOptions, int argc, char** argv) {
7070

7171
if (!runOptions.DontRunA) {
7272
runOptions.CommonOptions.Rps = runOptions.Read_rps;
73-
runOptions.CommonOptions.ReactionTime = TDuration::MilliSeconds(runOptions.CommonOptions.A_ReactionTime);
73+
runOptions.CommonOptions.ReactionTime = runOptions.ReadTimeout;
7474
jobs->Add(new TReadJob(runOptions.CommonOptions, maxId));
7575
}
7676
if (!runOptions.DontRunB) {
7777
runOptions.CommonOptions.Rps = runOptions.Write_rps;
78-
runOptions.CommonOptions.ReactionTime = DefaultReactionTime;
78+
runOptions.CommonOptions.ReactionTime = runOptions.WriteTimeout;
7979
jobs->Add(new TWriteJob(runOptions.CommonOptions, maxId));
8080
}
8181

ydb/public/sdk/cpp/tests/slo_workloads/key_value/ya.make

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
SUBSCRIBER(
2-
pnv1
3-
g:kikimr
4-
)
5-
61
PROGRAM()
72

83
SRCS(

ydb/public/sdk/cpp/tests/slo_workloads/utils/utils.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ using namespace NYdb;
1616

1717
const TDuration DefaultReactionTime = TDuration::Minutes(2);
1818
const TDuration ReactionTimeDelay = TDuration::MilliSeconds(5);
19-
const TDuration GlobalTimeout = TDuration::Minutes(2);
2019
const std::uint64_t PartitionsCount = 64;
2120

2221
Y_DECLARE_OUT_SPEC(, NYdb::TStatus, stream, value) {
@@ -434,8 +433,6 @@ void ParseOptionsCommon(TOpts& opts, TCommonOptions& options) {
434433
.DefaultValue(options.MinLength).StoreResult(&options.MinLength);
435434
opts.AddLongOption("payload-max", "Maximum length of payload string").RequiredArgument("NUM")
436435
.DefaultValue(options.MaxLength).StoreResult(&options.MaxLength);
437-
opts.AddLongOption("timeout", "Read requests execution timeout [ms]").RequiredArgument("NUM")
438-
.DefaultValue(options.A_ReactionTime).StoreResult(&options.A_ReactionTime);
439436
opts.AddLongOption("dont-push", "Do not push metrics").NoArgument()
440437
.SetFlag(&options.DontPushMetrics).DefaultValue(options.DontPushMetrics);
441438
opts.AddLongOption("metrics-push-url", "URL to push metrics").RequiredArgument("URL")
@@ -500,6 +497,10 @@ bool ParseOptionsRun(int argc, char** argv, TRunOptions& runOptions) {
500497
.SetFlag(&runOptions.DontRunB).DefaultValue(runOptions.DontRunB);
501498
opts.AddLongOption("infly", "Maximum number of running jobs").RequiredArgument("NUM")
502499
.DefaultValue(runOptions.CommonOptions.MaxInfly).StoreResult(&runOptions.CommonOptions.MaxInfly);
500+
opts.AddLongOption("read-timeout", "Read requests execution timeout [ms]").RequiredArgument("NUM")
501+
.DefaultValue(runOptions.ReadTimeout).StoreResult(&runOptions.ReadTimeout);
502+
opts.AddLongOption("write-timeout", "Write requests execution timeout [ms]").RequiredArgument("NUM")
503+
.DefaultValue(runOptions.WriteTimeout).StoreResult(&runOptions.WriteTimeout);
503504
TOptsParseResult res(&opts, argc, argv);
504505

505506
if (!CheckOptionsCommon(runOptions.CommonOptions)) {

ydb/public/sdk/cpp/tests/slo_workloads/utils/utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
extern const TDuration DefaultReactionTime;
1212
extern const TDuration ReactionTimeDelay;
13-
extern const TDuration GlobalTimeout;
1413
extern const std::uint64_t PartitionsCount;
1514

1615
struct TRecordData {
@@ -48,7 +47,6 @@ struct TCommonOptions {
4847
std::uint32_t MaxCallbackThreads = 50;
4948
std::uint32_t MaxInfly = 500;
5049
std::uint32_t MaxRetries = 50;
51-
std::uint64_t A_ReactionTime = 70; //ms
5250
TDuration ReactionTime = DefaultReactionTime;
5351
bool StopOnError = false;
5452
bool UseApplicationTimeout = false;
@@ -75,6 +73,8 @@ struct TRunOptions {
7573
bool DontRunB = false;
7674
std::uint32_t Read_rps = 1000;
7775
std::uint32_t Write_rps = 10;
76+
TDuration ReadTimeout = DefaultReactionTime;
77+
TDuration WriteTimeout = DefaultReactionTime;
7878
};
7979

8080
class TRpsProvider {

0 commit comments

Comments
 (0)