diff --git a/manifests/local-dind/dind-cluster-v1.12.sh b/manifests/local-dind/dind-cluster-v1.12.sh index ce07bab436..b15bea54a9 100755 --- a/manifests/local-dind/dind-cluster-v1.12.sh +++ b/manifests/local-dind/dind-cluster-v1.12.sh @@ -516,7 +516,7 @@ DIND_NO_PARALLEL_E2E="${DIND_NO_PARALLEL_E2E:-}" DNS_SERVICE="${DNS_SERVICE:-coredns}" APISERVER_PORT="${APISERVER_PORT:-8080}" REGISTRY_PORT="${REGISTRY_PORT:-5000}" -PV_NUMS="${PV_NUMS:-4}" +PV_NUMS="${PV_NUMS:-9}" DIND_CA_CERT_URL="${DIND_CA_CERT_URL:-}" DIND_PROPAGATE_HTTP_PROXY="${DIND_PROPAGATE_HTTP_PROXY:-}" diff --git a/tests/actions.go b/tests/actions.go index 8fbcd63573..c5f4211ce8 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -55,12 +55,13 @@ const ( period = 5 * time.Minute ) -func NewOperatorActions(cli versioned.Interface, kubeCli kubernetes.Interface, cfg *Config) OperatorActions { +func NewOperatorActions(cli versioned.Interface, kubeCli kubernetes.Interface, pollInterval time.Duration, cfg *Config) OperatorActions { return &operatorActions{ - cli: cli, - kubeCli: kubeCli, - pdControl: controller.NewDefaultPDControl(), - cfg: cfg, + cli: cli, + kubeCli: kubeCli, + pdControl: controller.NewDefaultPDControl(), + pollInterval: pollInterval, + cfg: cfg, } } @@ -125,10 +126,11 @@ type OperatorActions interface { } type operatorActions struct { - cli versioned.Interface - kubeCli kubernetes.Interface - pdControl controller.PDControlInterface - cfg *Config + cli versioned.Interface + kubeCli kubernetes.Interface + pdControl controller.PDControlInterface + pollInterval time.Duration + cfg *Config } var _ = OperatorActions(&operatorActions{}) @@ -419,7 +421,7 @@ func (oa *operatorActions) CleanTidbCluster(info *TidbClusterConfig) error { } return true, nil } - return wait.PollImmediate(DefaultPollInterval, DefaultPollTimeout, pollFn) + return wait.PollImmediate(oa.pollInterval, DefaultPollTimeout, pollFn) } func (oa *operatorActions) CleanTidbClusterOrDie(info *TidbClusterConfig) { @@ -433,7 +435,7 @@ func (oa *operatorActions) CheckTidbClusterStatus(info *TidbClusterConfig) error ns := info.Namespace tcName := info.ClusterName - if err := wait.PollImmediate(DefaultPollInterval, DefaultPollTimeout, func() (bool, error) { + if err := wait.PollImmediate(oa.pollInterval, DefaultPollTimeout, func() (bool, error) { var tc *v1alpha1.TidbCluster var err error if tc, err = oa.cli.PingcapV1alpha1().TidbClusters(ns).Get(tcName, metav1.GetOptions{}); err != nil { @@ -556,7 +558,7 @@ func (oa *operatorActions) ScaleTidbClusterOrDie(info *TidbClusterConfig) { } func (oa *operatorActions) CheckScaleInSafely(info *TidbClusterConfig) error { - return wait.Poll(DefaultPollInterval, DefaultPollTimeout, func() (done bool, err error) { + return wait.Poll(oa.pollInterval, DefaultPollTimeout, func() (done bool, err error) { tc, err := oa.cli.PingcapV1alpha1().TidbClusters(info.Namespace).Get(info.ClusterName, metav1.GetOptions{}) if err != nil { glog.Infof("failed to get tidbcluster when scale in tidbcluster, error: %v", err) @@ -591,7 +593,7 @@ func (oa *operatorActions) CheckScaleInSafely(info *TidbClusterConfig) error { } func (oa *operatorActions) CheckScaledCorrectly(info *TidbClusterConfig, podUIDsBeforeScale map[string]types.UID) error { - return wait.Poll(DefaultPollInterval, DefaultPollTimeout, func() (done bool, err error) { + return wait.Poll(oa.pollInterval, DefaultPollTimeout, func() (done bool, err error) { podUIDs, err := oa.GetPodUIDMap(info) if err != nil { glog.Infof("failed to get pd pods's uid, error: %v", err) @@ -630,7 +632,7 @@ func (oa *operatorActions) UpgradeTidbClusterOrDie(info *TidbClusterConfig) { } func (oa *operatorActions) CheckUpgradeProgress(info *TidbClusterConfig) error { - return wait.Poll(DefaultPollInterval, DefaultPollTimeout, func() (done bool, err error) { + return wait.Poll(oa.pollInterval, DefaultPollTimeout, func() (done bool, err error) { tc, err := oa.cli.PingcapV1alpha1().TidbClusters(info.Namespace).Get(info.ClusterName, metav1.GetOptions{}) if err != nil { glog.Infof("failed to get tidbcluster: [%s], error: %v", info.ClusterName, err) @@ -1429,7 +1431,7 @@ func (oa *operatorActions) CheckAdHocBackup(info *TidbClusterConfig) error { return true, nil } - err := wait.Poll(DefaultPollInterval, DefaultPollTimeout, fn) + err := wait.Poll(oa.pollInterval, DefaultPollTimeout, fn) if err != nil { return fmt.Errorf("failed to launch scheduler backup job: %v", err) } @@ -1496,7 +1498,7 @@ func (oa *operatorActions) CheckRestore(from *TidbClusterConfig, to *TidbCluster return true, nil } - err := wait.Poll(DefaultPollInterval, DefaultPollTimeout, fn) + err := wait.Poll(oa.pollInterval, DefaultPollTimeout, fn) if err != nil { return fmt.Errorf("failed to launch scheduler backup job: %v", err) } @@ -1647,7 +1649,7 @@ func (oa *operatorActions) CheckScheduledBackup(info *TidbClusterConfig) error { return true, nil } - err := wait.Poll(DefaultPollInterval, DefaultPollTimeout, fn) + err := wait.Poll(oa.pollInterval, DefaultPollTimeout, fn) if err != nil { return fmt.Errorf("failed to launch scheduler backup job: %v", err) } @@ -1724,7 +1726,7 @@ func (oa *operatorActions) getBackupDir(info *TidbClusterConfig) ([]string, erro return true, nil } - err := wait.Poll(DefaultPollInterval, DefaultPollTimeout, fn) + err := wait.Poll(oa.pollInterval, DefaultPollTimeout, fn) if err != nil { return nil, fmt.Errorf("failed to delete pod %s", getBackupDirPodName) @@ -1744,7 +1746,7 @@ func (oa *operatorActions) getBackupDir(info *TidbClusterConfig) ([]string, erro return true, nil } - err = wait.Poll(DefaultPollInterval, DefaultPollTimeout, fn) + err = wait.Poll(oa.pollInterval, DefaultPollTimeout, fn) if err != nil { return nil, fmt.Errorf("failed to create pod %s", getBackupDirPodName) @@ -1858,7 +1860,7 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig) error return true, nil } - err := wait.Poll(DefaultPollInterval, DefaultPollTimeout, fn) + err := wait.Poll(oa.pollInterval, DefaultPollTimeout, fn) if err != nil { return fmt.Errorf("failed to launch scheduler backup job: %v", err) } diff --git a/tests/cmd/e2e/main.go b/tests/cmd/e2e/main.go index 5c71b1a71f..a180c0896a 100644 --- a/tests/cmd/e2e/main.go +++ b/tests/cmd/e2e/main.go @@ -16,6 +16,7 @@ package main import ( "fmt" _ "net/http/pprof" + "time" "github.com/golang/glog" "github.com/jinzhu/copier" @@ -34,7 +35,7 @@ func main() { conf.ChartDir = "/charts" cli, kubeCli := client.NewCliOrDie() - oa := tests.NewOperatorActions(cli, kubeCli, conf) + oa := tests.NewOperatorActions(cli, kubeCli, 5*time.Second, conf) // start a http server in goruntine go oa.StartValidatingAdmissionWebhookServerOrDie() @@ -83,11 +84,11 @@ func main() { "pd.resources.requests.memory": "1Gi", "tikv.resources.limits.cpu": "2000m", "tikv.resources.limits.memory": "4Gi", - "tikv.resources.requests.cpu": "1000m", - "tikv.resources.requests.memory": "2Gi", + "tikv.resources.requests.cpu": "200m", + "tikv.resources.requests.memory": "1Gi", "tidb.resources.limits.cpu": "2000m", "tidb.resources.limits.memory": "4Gi", - "tidb.resources.requests.cpu": "500m", + "tidb.resources.requests.cpu": "200m", "tidb.resources.requests.memory": "1Gi", }, Args: map[string]string{}, @@ -114,11 +115,11 @@ func main() { "pd.resources.requests.memory": "1Gi", "tikv.resources.limits.cpu": "2000m", "tikv.resources.limits.memory": "4Gi", - "tikv.resources.requests.cpu": "1000m", - "tikv.resources.requests.memory": "2Gi", + "tikv.resources.requests.cpu": "200m", + "tikv.resources.requests.memory": "1Gi", "tidb.resources.limits.cpu": "2000m", "tidb.resources.limits.memory": "4Gi", - "tidb.resources.requests.cpu": "500m", + "tidb.resources.requests.cpu": "200m", "tidb.resources.requests.memory": "1Gi", }, Args: map[string]string{}, diff --git a/tests/cmd/stability/main.go b/tests/cmd/stability/main.go index 7ebf2ad81e..e7926d83c3 100644 --- a/tests/cmd/stability/main.go +++ b/tests/cmd/stability/main.go @@ -37,7 +37,7 @@ func main() { conf := tests.ParseConfigOrDie() cli, kubeCli := client.NewCliOrDie() - oa := tests.NewOperatorActions(cli, kubeCli, conf) + oa := tests.NewOperatorActions(cli, kubeCli, tests.DefaultPollTimeout, conf) fta := tests.NewFaultTriggerAction(cli, kubeCli, conf) fta.CheckAndRecoverEnvOrDie()