Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
olivia_chen authored and olivia_chen committed Jun 25, 2023
1 parent 91320aa commit c09a80a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/manager/member/startscript/v1/render_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func RenderPDStartScript(tc *v1alpha1.TidbCluster) (string, error) {
AcrossK8s: tc.AcrossK8s(),
ClusterDomain: tc.Spec.ClusterDomain,
},
Scheme: tc.Scheme(),
DataDir: filepath.Join(constants.PDDataVolumeMountPath, tc.Spec.PD.DataSubDir),
StartTimeout: tc.Spec.PD.StartTimeout,
Scheme: tc.Scheme(),
DataDir: filepath.Join(constants.PDDataVolumeMountPath, tc.Spec.PD.DataSubDir),
PDStartTimeout: tc.Spec.PD.StartTimeout,
}
if tc.Spec.PD.StartUpScriptVersion == "v1" {
model.CheckDomainScript = checkDNSV1
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager/member/startscript/v1/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ encoded_domain_url=` + "`" + `echo ${domain}:2380 | base64 | tr "\n" " " | sed "
`
elapseTime=0
period=1
threshold={{ .PDStartTimeout }}
threshold={{ .PDStartTimeout }}
while true; do
sleep ${period}
elapseTime=$(( elapseTime+period ))
Expand Down Expand Up @@ -245,7 +245,7 @@ type PDStartScriptModel struct {
Scheme string
DataDir string
CheckDomainScript string
StartTimeout int
PDStartTimeout int
}

var tikvStartScriptTplText = `#!/bin/sh
Expand Down
4 changes: 3 additions & 1 deletion pkg/manager/member/startscript/v1/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,9 @@ exec /pd-server ${ARGS}

tc := &v1alpha1.TidbCluster{
Spec: v1alpha1.TidbClusterSpec{
PD: &v1alpha1.PDSpec{},
PD: &v1alpha1.PDSpec{
StartTimeout: 30,
},
},
}
tc.Name = "test-pd"
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/startscript/v2/pd_start_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ PD_DOMAIN={{ .PDDomain }}
elapseTime=0
period=1
threshold={{ .PDStartTimeout }}
threshold={{ .PDStartTimeout }}
while true; do
sleep ${period}
elapseTime=$(( elapseTime+period ))
Expand Down
4 changes: 3 additions & 1 deletion pkg/manager/member/startscript/v2/pd_start_script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,9 @@ exec /pd-server ${ARGS}

tc := &v1alpha1.TidbCluster{
Spec: v1alpha1.TidbClusterSpec{
PD: &v1alpha1.PDSpec{},
PD: &v1alpha1.PDSpec{
StartTimeout: 30,
},
},
}
tc.Name = "start-script-test"
Expand Down

0 comments on commit c09a80a

Please sign in to comment.