Skip to content

Commit

Permalink
e2e: Make incremental backup test work (#764)
Browse files Browse the repository at this point in the history
* e2e:Add json tag to pump statusmap

* e2e: add protocol name in get drainer and pump

* fix typo

* add some log

* delete log and adjust misunderstand of drainer field Synced
  • Loading branch information
shuijing198799 authored Aug 13, 2019
1 parent 7ca566e commit a3c9889
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD
for _, pod := range pods.Items {
if !oa.pumpHealth(info, pod.Spec.Hostname) {
glog.Errorf("some pods is not health %s", pumpStatefulSetName)
// return false, nil
return false, nil
}

if isv1 {
Expand Down Expand Up @@ -2396,7 +2396,7 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD
listOps = metav1.ListOptions{
LabelSelector: labels.SelectorFromSet(
map[string]string{
label.ComponentLabelKey: "pump",
label.ComponentLabelKey: "drainer",
label.InstanceLabelKey: drainerStatefulSet.Labels[label.InstanceLabelKey],
label.NameLabelKey: "tidb-cluster",
},
Expand All @@ -2410,7 +2410,7 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD
for _, pod := range pods.Items {
if !oa.drainerHealth(info, pod.Spec.Hostname) {
glog.Errorf("some pods is not health %s", drainerStatefulSetName)
// return false, nil
return false, nil
}

if isv1 {
Expand Down Expand Up @@ -2515,15 +2515,15 @@ func (oa *operatorActions) CleanWebHookAndServiceOrDie(info *OperatorConfig) {
}

type pumpStatus struct {
StatusMap map[string]*nodeStatus
StatusMap map[string]*nodeStatus `json:"StatusMap"`
}

type nodeStatus struct {
State string `json:"state"`
}

func (oa *operatorActions) pumpHealth(info *TidbClusterConfig, hostName string) bool {
pumpHealthURL := fmt.Sprintf("%s.%s-pump.%s:8250/status", hostName, info.ClusterName, info.Namespace)
pumpHealthURL := fmt.Sprintf("http://%s.%s-pump.%s:8250/status", hostName, info.ClusterName, info.Namespace)
res, err := http.Get(pumpHealthURL)
if err != nil {
glog.Errorf("cluster:[%s] call %s failed,error:%v", info.ClusterName, pumpHealthURL, err)
Expand Down Expand Up @@ -2561,7 +2561,7 @@ type drainerStatus struct {
}

func (oa *operatorActions) drainerHealth(info *TidbClusterConfig, hostName string) bool {
drainerHealthURL := fmt.Sprintf("%s.%s-drainer.%s:8249/status", hostName, info.ClusterName, info.Namespace)
drainerHealthURL := fmt.Sprintf("http://%s.%s-drainer.%s:8249/status", hostName, info.ClusterName, info.Namespace)
res, err := http.Get(drainerHealthURL)
if err != nil {
glog.Errorf("cluster:[%s] call %s failed,error:%v", info.ClusterName, drainerHealthURL, err)
Expand All @@ -2582,7 +2582,7 @@ func (oa *operatorActions) drainerHealth(info *TidbClusterConfig, hostName strin
glog.Errorf("cluster:[%s] unmarshal failed,error:%v", info.ClusterName, err)
return false
}
return len(healths.PumpPos) > 0 && healths.Synced
return len(healths.PumpPos) > 0
}

func (oa *operatorActions) EmitEvent(info *TidbClusterConfig, message string) {
Expand Down

0 comments on commit a3c9889

Please sign in to comment.