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
OCM-6318 | ci: Build up deprovision step #1954
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jameszwang The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
errors = append(errors, err) | ||
return | ||
} | ||
fmt.Println(cdContent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't fmt.Println
) | ||
|
||
// get cluster info from cluster detail file | ||
cdContent, err := common.ReadFileContent(config.Test.ClusterDetailFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not put everything in same function. Split the resource data func out.
|
||
// delete KMS key | ||
if ud.KMSKey != "" { | ||
fmt.Printf("kms key: %s", ud.KMSKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove fmt.Printf
And use log
// delete cluster | ||
clusterService = client.Cluster | ||
output, errDeleteCluster := clusterService.DeleteCluster(cd.ClusterID, "-y") | ||
if errDeleteCluster != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If cluster deletion error, other resources cannot be deleted. You can just return here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And have you ever tried delete non-existing cluster, if it will fail? We should consider about cluster already being deleted status.
tests/e2e/e2e_tear_down_test.go
Outdated
) | ||
|
||
var _ = Describe("ROSA CLI Test", func() { | ||
It("Deprovision cluster", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It("Deprovision cluster", | |
It("DestroyClusterByProfile", |
?
} | ||
|
||
switch output.State { | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a switch with only default
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove state check. Just when state=="uninstalling"
then wait, otherwise return the error message of fmt.Errorf("Cluster %s is in status of %s which won't be deleted, stop waiting", cluster, state)
output, err := client.Cluster.DescribeClusterAndReflect(cluster) | ||
if err != nil { | ||
outputInfo, err := client.Cluster.DescribeCluster(cluster) | ||
if strings.Contains(outputInfo.String(), "There is no cluster with identifier or name '"+cluster+"'") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fmt.Sprintf
rather than +
for time.Now().Before(endTime) { | ||
output, err := client.Cluster.DescribeClusterAndReflect(cluster) | ||
if err != nil { | ||
outputInfo, err := client.Cluster.DescribeCluster(cluster) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to describe again. Just check if the output
contains the keyword
if strings.Contains(outputInfo.String(), "There is no cluster with identifier or name '"+cluster+"'") { | ||
log.Logger.Infof("Cluster %s has been deleted.", cluster) | ||
return nil | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove else
, just return err
@jameszwang: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
OCM-6318 | ci: Build up deprovision step