Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 1a950ac

Browse files
committed
add staleread casew
Signed-off-by: yisaer <disxiaofei@163.com>
1 parent b9b275e commit 1a950ac

File tree

5 files changed

+49
-11
lines changed

5 files changed

+49
-11
lines changed

pkg/test-infra/tidb/recommend.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ func RecommendedTiDBCluster(ns, name string, clusterConfig fixture.TiDBClusterCo
162162
MountPath: "/var/log/pdlog",
163163
},
164164
},
165+
Service: &v1alpha1.ServiceSpec{
166+
Type: corev1.ServiceTypeNodePort,
167+
},
165168
},
166169
TiKV: &v1alpha1.TiKVSpec{
167170
Replicas: int32(clusterConfig.TiKVReplicas),
@@ -260,6 +263,9 @@ func RecommendedTiDBCluster(ns, name string, clusterConfig fixture.TiDBClusterCo
260263
Version: "v2.11.1",
261264
},
262265
LogLevel: "info",
266+
Service: v1alpha1.ServiceSpec{
267+
Type: corev1.ServiceTypeNodePort,
268+
},
263269
},
264270
Grafana: &v1alpha1.GrafanaSpec{
265271
Service: v1alpha1.ServiceSpec{

run/lib/case.libsonnet

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
'/bin/cross-region',
5959
'-tso-request-count=%s' % args.tso_request_count,
6060
],
61+
staleread(args={})::
62+
[
63+
'/bin/stale-read',
64+
],
6165
'example'(args={})::
6266
[
6367
'/bin/example',

run/workflow/stale-read.jsonnet

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
_config+:: {
3+
case_name: 'staleread',
4+
image_name: 'hub.pingcap.net/qa/tipocket',
5+
args+: {
6+
// k8s configurations
7+
// 'storage-class': 'local-storage',
8+
// tidbcluster configurations
9+
// 'pd-storage-class': 'shared-local-storage',
10+
// 'tikv-storage-class': 'local-storage',
11+
// 'log-storage-class': 'shared-sas',
12+
},
13+
command: {},
14+
},
15+
}

testcase/stale-read/cmd/main.go

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ package main
33
import (
44
"context"
55
"flag"
6-
staleread "github.com/pingcap/tipocket/testcase/stale-read"
7-
8-
// use mysql
9-
_ "github.com/go-sql-driver/mysql"
6+
"time"
107

118
"github.com/pingcap/tipocket/cmd/util"
129
logs "github.com/pingcap/tipocket/logsearch/pkg/logs"
1310
"github.com/pingcap/tipocket/pkg/cluster"
1411
"github.com/pingcap/tipocket/pkg/control"
1512
test_infra "github.com/pingcap/tipocket/pkg/test-infra"
1613
"github.com/pingcap/tipocket/pkg/test-infra/fixture"
14+
staleread "github.com/pingcap/tipocket/testcase/stale-read"
15+
)
16+
17+
var (
18+
workerCount = flag.Int("sysbench-worker-count", 1, "the worker count of the sysbench")
19+
runDuration = flag.Duration("sysbench-duration", 1*time.Minute, "the duration of the sysbench running")
20+
rowsEachInsert = flag.Int("rows-each-insert", 50, "rows each time insert")
21+
insertCount = flag.Int("insert-count", 20, "count of the inserting")
1722
)
1823

1924
func main() {
2025
flag.Parse()
2126
fixture.Context.ClusterName = "stale-read"
22-
fixture.Context.Namespace = "gaosong"
2327
cfg := control.Config{
2428
Mode: control.ModeStandard,
2529
ClientCount: 1,
@@ -36,12 +40,19 @@ func main() {
3640
c.TiDBClusterConfig.TiDBImage = "hub.pingcap.net/gaosong/tidb:newly-master"
3741
c.TiDBClusterConfig.TiKVImage = "hub.pingcap.net/gaosong/tikv:newly-master"
3842
suit := util.Suit{
39-
Config: &cfg,
40-
Provider: cluster.NewDefaultClusterProvider(),
41-
ClientCreator: staleread.ClientCreator{},
42-
NemesisGens: util.ParseNemesisGenerators(fixture.Context.Nemesis),
43-
ClusterDefs: test_infra.NewDefaultCluster(c.Namespace, c.ClusterName, c.TiDBClusterConfig),
44-
LogsClient: logs.NewDiagnosticLogClient(),
43+
Config: &cfg,
44+
Provider: cluster.NewDefaultClusterProvider(),
45+
ClientCreator: staleread.ClientCreator{
46+
Config: staleread.Config{
47+
SysBenchWorkerCount: *workerCount,
48+
SysBenchDuration: *runDuration,
49+
RowsEachInsert: *rowsEachInsert,
50+
InsertCount: *insertCount,
51+
},
52+
},
53+
NemesisGens: util.ParseNemesisGenerators(fixture.Context.Nemesis),
54+
ClusterDefs: test_infra.NewDefaultCluster(c.Namespace, c.ClusterName, c.TiDBClusterConfig),
55+
LogsClient: logs.NewDiagnosticLogClient(),
4556
}
4657
suit.Run(context.Background())
4758
}

testcase/stale-read/stale-read.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ func (c *staleReadClient) Start(ctx context.Context, cfg interface{}, cnodes []c
116116
default:
117117
log.Warn("mode value transform error")
118118
}
119+
// assert metrics here
120+
handleStoreMetricsValue(smvms, c.duration)
119121
return nil
120122
}
121123

0 commit comments

Comments
 (0)