From 7066d6bfc251f9dd38df5d1c4a24bec441c937a0 Mon Sep 17 00:00:00 2001 From: shuijing198799 <490278485@qq.com> Date: Mon, 12 Aug 2019 11:13:56 +0800 Subject: [PATCH 1/5] e2e:Add json tag to pump statusmap --- tests/actions.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/actions.go b/tests/actions.go index 2ac1119048d..f12bdb86ce5 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -2350,7 +2350,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 } glog.Info(pod.Spec.Affinity) if len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 { @@ -2401,7 +2401,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 } glog.Info(pod.Spec.Affinity) if len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 { @@ -2501,7 +2501,7 @@ func (oa *operatorActions) CleanWebHookAndServiceOrDie(info *OperatorConfig) { } type pumpStatus struct { - StatusMap map[string]*nodeStatus + StatusMap map[string]*nodeStatus `json:"statusMap"` } type nodeStatus struct { From abef3a189d09d52707da1f765fa01822f2481017 Mon Sep 17 00:00:00 2001 From: shuijing198799 <490278485@qq.com> Date: Tue, 13 Aug 2019 10:38:15 +0800 Subject: [PATCH 2/5] e2e: add protocol name in get drainer and pump --- tests/actions.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/actions.go b/tests/actions.go index f12bdb86ce5..bb73b6d523a 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -2501,7 +2501,7 @@ func (oa *operatorActions) CleanWebHookAndServiceOrDie(info *OperatorConfig) { } type pumpStatus struct { - StatusMap map[string]*nodeStatus `json:"statusMap"` + StatusMap map[string]*nodeStatus `json:"StatusMap"` } type nodeStatus struct { @@ -2509,7 +2509,7 @@ type nodeStatus struct { } 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) @@ -2547,7 +2547,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) From f875c67075f77e9096075b866b8713a649bba715 Mon Sep 17 00:00:00 2001 From: shuijing198799 <490278485@qq.com> Date: Tue, 13 Aug 2019 11:10:55 +0800 Subject: [PATCH 3/5] fix typo --- tests/actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/actions.go b/tests/actions.go index 4095bd360f2..7c2febd4372 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -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", }, From 7e33121dedfbf686e6fa76138f783f9b01e19416 Mon Sep 17 00:00:00 2001 From: shuijing198799 <490278485@qq.com> Date: Tue, 13 Aug 2019 11:45:59 +0800 Subject: [PATCH 4/5] add some log --- tests/actions.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/actions.go b/tests/actions.go index 7c2febd4372..3cf5577a1db 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -2577,11 +2577,13 @@ func (oa *operatorActions) drainerHealth(info *TidbClusterConfig, hostName strin return false } healths := drainerStatus{} + glog.Infof("drainer body is [%s]", body) err = json.Unmarshal(body, &healths) if err != nil { glog.Errorf("cluster:[%s] unmarshal failed,error:%v", info.ClusterName, err) return false } + glog.Infof("drainer unmarshal body is [%v]", healths) return len(healths.PumpPos) > 0 && healths.Synced } From 0b7457e99bdee6a62b64f657c816b5ff5d4dd941 Mon Sep 17 00:00:00 2001 From: shuijing198799 <490278485@qq.com> Date: Tue, 13 Aug 2019 13:06:24 +0800 Subject: [PATCH 5/5] delete log and adjust misunderstand of drainer field Synced --- tests/actions.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/actions.go b/tests/actions.go index 3cf5577a1db..3db04fcd15e 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -2577,14 +2577,12 @@ func (oa *operatorActions) drainerHealth(info *TidbClusterConfig, hostName strin return false } healths := drainerStatus{} - glog.Infof("drainer body is [%s]", body) err = json.Unmarshal(body, &healths) if err != nil { glog.Errorf("cluster:[%s] unmarshal failed,error:%v", info.ClusterName, err) return false } - glog.Infof("drainer unmarshal body is [%v]", healths) - return len(healths.PumpPos) > 0 && healths.Synced + return len(healths.PumpPos) > 0 } func (oa *operatorActions) EmitEvent(info *TidbClusterConfig, message string) {