Skip to content

Commit

Permalink
fix e2e test compatible with v1.0.0 (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored and weekface committed Aug 14, 2019
1 parent 6e10a21 commit 6595a33
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 6595a33

Please sign in to comment.