Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use TidbCluster CRD to simplify the test and increase wait timeout #1786

Merged
merged 1 commit into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ kubeconfig

# local output directory
/output/
# local artifacts directory
/artifacts/
# kubetest2 default artifacts directory
/_artifacts/
23 changes: 13 additions & 10 deletions tests/e2e/tidbcluster/serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,15 @@ var _ = ginkgo.Describe("[tidb-operator][Serial]", func() {
})

ginkgo.It("Scaling tidb cluster with advanced statefulset", func() {
clusterName := "deploy"
cluster := newTidbClusterConfig(e2econfig.TestConfig, ns, clusterName, "", "")
cluster.Resources["pd.replicas"] = "3"
cluster.Resources["tikv.replicas"] = "5"
cluster.Resources["tidb.replicas"] = "3"
oa.DeployTidbClusterOrDie(&cluster)
oa.CheckTidbClusterStatusOrDie(&cluster)
clusterName := "scaling-with-asts"
tc := fixture.GetTidbCluster(ns, clusterName, utilimage.TiDBV3Version)
tc.Spec.PD.Replicas = 3
tc.Spec.TiKV.Replicas = 5
tc.Spec.TiDB.Replicas = 5
err := genericCli.Create(context.TODO(), tc)
framework.ExpectNoError(err)
err = oa.WaitForTidbClusterReady(tc, 30*time.Minute, 15*time.Second)
framework.ExpectNoError(err)

scalingTests := []struct {
name string
Expand Down Expand Up @@ -260,14 +262,14 @@ var _ = ginkgo.Describe("[tidb-operator][Serial]", func() {
framework.ExpectNoError(err)

ginkgo.By(fmt.Sprintf("Waiting for all pods of tidb cluster component %s (sts: %s/%s) are in desired state (replicas: %d, delete slots: %v)", st.component, ns, stsName, st.replicas, st.deleteSlots.List()))
err = wait.PollImmediate(time.Second*5, time.Minute*10, func() (bool, error) {
err = wait.PollImmediate(time.Second*5, time.Minute*15, func() (bool, error) {
// check replicas and delete slots are synced
sts, err = hc.AppsV1().StatefulSets(ns).Get(stsName, metav1.GetOptions{})
if err != nil {
return false, nil
}
if *sts.Spec.Replicas != st.replicas {
klog.Infof("replicas of sts %s/%s is %d, expects %d", ns, stsName, sts.Spec.Replicas, st.replicas)
klog.Infof("replicas of sts %s/%s is %d, expects %d", ns, stsName, *sts.Spec.Replicas, st.replicas)
return false, nil
}
if !helper.GetDeleteSlots(sts).Equal(st.deleteSlots) {
Expand All @@ -292,7 +294,8 @@ var _ = ginkgo.Describe("[tidb-operator][Serial]", func() {
}
}

oa.CheckTidbClusterStatusOrDie(&cluster)
err = oa.WaitForTidbClusterReady(tc, 30*time.Minute, 15*time.Second)
framework.ExpectNoError(err)
})
})

Expand Down