Skip to content

Commit

Permalink
fix e2e test compatible with v1.0.0 (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
weekface authored Aug 12, 2019
1 parent adab8c4 commit 7ca566e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7ca566e

Please sign in to comment.