Skip to content

Commit

Permalink
add operator upgrade case
Browse files Browse the repository at this point in the history
  • Loading branch information
weekface committed Jun 14, 2019
1 parent d6c5fe6 commit 863aad2
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 275 deletions.
22 changes: 22 additions & 0 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type OperatorActions interface {
CleanOperator(info *OperatorConfig) error
CleanOperatorOrDie(info *OperatorConfig)
UpgradeOperator(info *OperatorConfig) error
UpgradeOperatorOrDie(info *OperatorConfig)
DumpAllLogs(info *OperatorConfig, clusterInfos []*TidbClusterConfig) error
DeployTidbCluster(info *TidbClusterConfig) error
DeployTidbClusterOrDie(info *TidbClusterConfig)
Expand Down Expand Up @@ -160,6 +161,7 @@ type OperatorActions interface {
RegisterWebHookAndService(context *apimachinery.CertContext, info *OperatorConfig) error
RegisterWebHookAndServiceOrDie(context *apimachinery.CertContext, info *OperatorConfig)
CleanWebHookAndService(info *OperatorConfig) error
CleanWebHookAndServiceOrDie(info *OperatorConfig)
EventWorker()
EmitEvent(info *TidbClusterConfig, msg string)
BackupRestore(from, to *TidbClusterConfig) error
Expand Down Expand Up @@ -463,7 +465,20 @@ func (oa *operatorActions) UpgradeOperator(info *OperatorConfig) error {
return nil
}

func (oa *operatorActions) UpgradeOperatorOrDie(info *OperatorConfig) {
if err := oa.UpgradeOperator(info); err != nil {
slack.NotifyAndPanic(err)
}
}

func (oa *operatorActions) DeployTidbCluster(info *TidbClusterConfig) error {
ns := info.Namespace
tcName := info.ClusterName
if _, err := oa.cli.PingcapV1alpha1().TidbClusters(ns).Get(tcName, metav1.GetOptions{}); err == nil {
// already deployed
return nil
}

glog.Infof("deploying tidb cluster [%s/%s]", info.Namespace, info.ClusterName)
oa.EmitEvent(info, "DeployTidbCluster")

Expand Down Expand Up @@ -2230,6 +2245,13 @@ func (oa *operatorActions) CleanWebHookAndService(info *OperatorConfig) error {
return nil
}

func (oa *operatorActions) CleanWebHookAndServiceOrDie(info *OperatorConfig) {
err := oa.CleanWebHookAndService(info)
if err != nil {
slack.NotifyAndPanic(err)
}
}

type pumpStatus struct {
StatusMap map[string]*nodeStatus
}
Expand Down
Loading

0 comments on commit 863aad2

Please sign in to comment.