Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix e2e test compatible with v1.0.0 (#757) #762

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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