Skip to content

Commit

Permalink
Fix incorrect error code judgment in e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: whitewindmills <[email protected]>
  • Loading branch information
whitewindmills committed Jul 30, 2024
1 parent 3a4861f commit 5759315
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 18 deletions.
9 changes: 0 additions & 9 deletions test/e2e/failover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,6 @@ func disableCluster(c client.Client, clusterName string) error {
err := wait.PollUntilContextTimeout(context.TODO(), pollInterval, pollTimeout, true, func(ctx context.Context) (done bool, err error) {
clusterObj := &clusterv1alpha1.Cluster{}
if err := c.Get(ctx, client.ObjectKey{Name: clusterName}, clusterObj); err != nil {
if apierrors.IsConflict(err) {
return false, nil
}
return false, err
}
// set the APIEndpoint of matched cluster to a wrong value
Expand All @@ -552,9 +549,6 @@ func taintCluster(c client.Client, clusterName string, taint corev1.Taint) error
err := wait.PollUntilContextTimeout(context.TODO(), pollInterval, pollTimeout, true, func(ctx context.Context) (done bool, err error) {
clusterObj := &clusterv1alpha1.Cluster{}
if err := c.Get(ctx, client.ObjectKey{Name: clusterName}, clusterObj); err != nil {
if apierrors.IsConflict(err) {
return false, nil
}
return false, err
}
clusterObj.Spec.Taints = append(clusterObj.Spec.Taints, taint)
Expand All @@ -574,9 +568,6 @@ func recoverTaintedCluster(c client.Client, clusterName string, taint corev1.Tai
err := wait.PollUntilContextTimeout(context.TODO(), pollInterval, pollTimeout, true, func(ctx context.Context) (done bool, err error) {
clusterObj := &clusterv1alpha1.Cluster{}
if err := c.Get(ctx, client.ObjectKey{Name: clusterName}, clusterObj); err != nil {
if apierrors.IsConflict(err) {
return false, nil
}
return false, err
}
clusterObj.Spec.Taints = helper.SetCurrentClusterTaints(nil, []*corev1.Taint{&taint}, clusterObj)
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/framework/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ func setClusterLabel(c client.Client, clusterName string) error {
err := wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 10*time.Second, true, func(ctx context.Context) (done bool, err error) {
clusterObj := &clusterv1alpha1.Cluster{}
if err := c.Get(ctx, client.ObjectKey{Name: clusterName}, clusterObj); err != nil {
if apierrors.IsConflict(err) {
return false, nil
}
return false, err
}
if clusterObj.Labels == nil {
Expand Down Expand Up @@ -337,9 +334,6 @@ func SetClusterRegion(c client.Client, clusterName string, regionName string) er
return wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 10*time.Second, true, func(ctx context.Context) (done bool, err error) {
clusterObj := &clusterv1alpha1.Cluster{}
if err := c.Get(ctx, client.ObjectKey{Name: clusterName}, clusterObj); err != nil {
if apierrors.IsConflict(err) {
return false, nil
}
return false, err
}

Expand Down
3 changes: 0 additions & 3 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,6 @@ func deleteClusterLabel(c client.Client, clusterName string) error {
err := wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 10*time.Second, true, func(ctx context.Context) (done bool, err error) {
clusterObj := &clusterv1alpha1.Cluster{}
if err := c.Get(ctx, client.ObjectKey{Name: clusterName}, clusterObj); err != nil {
if apierrors.IsConflict(err) {
return false, nil
}
return false, err
}
delete(clusterObj.Labels, "location")
Expand Down

0 comments on commit 5759315

Please sign in to comment.