Merge pull request #62285 from nikhiljindal/removeClusters

Automatic merge from submit-queue (batch tested with PRs 62209, 62281, 61792, 62285, 61973). 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 check for error in output string

RunKubemciWithKubeconfig returns an error only if there was an error in running the command. Since remove-clusters command runs fine, it does not return an error. Updating the test to check for output string to contain the error message rather than expecting RunKubemciWithKubeconfig to return an error.
Also added a check to verify that status still returns the same status when remove-clusters command is run without --force flag.

cc @G-Harmon

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-04-09 16:00:17 -07:00 committed by GitHub
commit 4046fdb326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -713,9 +713,15 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
// 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("expected non-nil error in running kubemci remove-clusters to remove from all clusters")
output, err := framework.RunKubemciWithKubeconfig("remove-clusters", name, "--ingress="+filePath)
if err != nil {
framework.Failf("unexpected error in running kubemci remove-clusters command to remove from all clusters: %s", err)
}
if !strings.Contains(output, "You should use kubemci delete to delete the ingress completely") {
framework.Failf("unexpected output in removing an ingress from all clusters, expected the output to include: You should use kubemci delete to delete the ingress completely, actual output: %s", output)
}
// Verify that the ingress is still spread to 1 cluster as expected.
verifyKubemciStatusHas(name, "is spread across 1 cluster")
// 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)