From 2f8109047a387504bca308128d3cbd11387d3e4d Mon Sep 17 00:00:00 2001 From: weekface Date: Mon, 12 Aug 2019 14:48:01 +0800 Subject: [PATCH] fix e2e test compatible with v1.0.0 --- tests/actions.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/actions.go b/tests/actions.go index 2ac1119048..050a40607c 100644 --- a/tests/actions.go +++ b/tests/actions.go @@ -2347,13 +2347,22 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD return false, nil } + // v1.0.0 don't have affinity test case + // https://github.com/pingcap/tidb-operator/pull/746 + isv1 := info.OperatorTag == "v1.0.0" + for _, pod := range pods.Items { if !oa.pumpHealth(info, pod.Spec.Hostname) { glog.Errorf("some pods is not health %s", pumpStatefulSetName) // return false, nil } + + if isv1 { + continue + } + glog.Info(pod.Spec.Affinity) - if len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 { + if pod.Spec.Affinity == nil || pod.Spec.Affinity.PodAntiAffinity == nil || len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 { return true, fmt.Errorf("pump pod %s/%s should have affinity set", pod.Namespace, pod.Name) } glog.Info(pod.Spec.Tolerations) @@ -2403,8 +2412,13 @@ func (oa *operatorActions) CheckIncrementalBackup(info *TidbClusterConfig, withD glog.Errorf("some pods is not health %s", drainerStatefulSetName) // return false, nil } + + if isv1 { + continue + } + glog.Info(pod.Spec.Affinity) - if len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 { + if pod.Spec.Affinity == nil || pod.Spec.Affinity.PodAntiAffinity == nil || len(pod.Spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution) != 1 { return true, fmt.Errorf("drainer pod %s/%s should have spec.affinity set", pod.Namespace, pod.Name) } glog.Info(pod.Spec.Tolerations)