Merge pull request #62176 from nikhiljindal/removeClustersForce

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Updating kubemci remove-clusters e2e test to use --force to remove from all clusters

Ref https://github.com/GoogleCloudPlatform/k8s-multicluster-ingress/pull/173

Updating kubemci remove-clusters e2e test to validate that removing all clusters throws an error. It should succeed with --force=true

cc @G-Harmon

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-04-06 12:18:27 -07:00 committed by GitHub
commit 8282eff12f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -673,10 +673,15 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
name := jig.Ingress.Name
// Verify that the ingress is spread to 1 cluster as expected.
verifyKubemciStatusHas(name, "is spread across 1 cluster")
// Validate that removing the ingress from all clusters throws an error.
// Reuse the ingress file created while creating the ingress.
filePath := filepath.Join(framework.TestContext.OutputDir, "mci.yaml")
if _, err := framework.RunKubemciWithKubeconfig("remove-clusters", name, "--ingress="+filePath); err != nil {
framework.Failf("unexpected error in running kubemci remove-clusters: %s", err)
if _, err := framework.RunKubemciWithKubeconfig("remove-clusters", name, "--ingress="+filePath); err == nil {
framework.Failf("expected non-nil error in running kubemci remove-clusters to remove from all clusters")
}
// remove-clusters should succeed with --force=true
if _, err := framework.RunKubemciWithKubeconfig("remove-clusters", name, "--ingress="+filePath, "--force=true"); err != nil {
framework.Failf("unexpected error in running kubemci remove-clusters to remove from all clusters with --force=true: %s", err)
}
verifyKubemciStatusHas(name, "is spread across 0 cluster")
})