-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCM-6318 | ci: Build up deprovision step
- Loading branch information
1 parent
4534b3c
commit 252c67d
Showing
5 changed files
with
314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package e2e | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/openshift/rosa/tests/ci/labels" | ||
"github.com/openshift/rosa/tests/utils/exec/rosacli" | ||
ph "github.com/openshift/rosa/tests/utils/profilehandler" | ||
) | ||
|
||
var _ = Describe("ROSA CLI Test", func() { | ||
It("DestroyClusterByProfile", | ||
labels.Critical, | ||
labels.Destroy, | ||
func() { | ||
client := rosacli.NewClient() | ||
profile := ph.LoadProfileYamlFileByENV() | ||
var errs = ph.DestroyResourceByProfile(profile, client) | ||
Expect(len(errs)).To(Equal(0)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package profilehandler | ||
|
||
import ( | ||
"github.com/openshift-online/ocm-common/pkg/aws/aws_client" | ||
"github.com/openshift-online/ocm-common/pkg/test/kms_key" | ||
"github.com/openshift-online/ocm-common/pkg/test/vpc_client" | ||
) | ||
|
||
func DeleteVPCChain(vpcID string, region string) error { | ||
vpcClient, err := vpc_client.GenerateVPCByID(vpcID, region) | ||
if err != nil { | ||
return err | ||
} | ||
return vpcClient.DeleteVPCChain() | ||
} | ||
|
||
func ScheduleKMSDesiable(kmsKey string, region string) error { | ||
return kms_key.ScheduleKeyDeletion(kmsKey, region) | ||
} | ||
|
||
func DeleteAuditLogRoleArn(arn string, region string) error { | ||
awsClent, err := aws_client.CreateAWSClient("", region) | ||
if err != nil { | ||
return err | ||
} | ||
return awsClent.DeleteRoleAndPolicy(arn, false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package profilehandler | ||
|
||
import ( | ||
"encoding/json" | ||
"os" | ||
|
||
"github.com/openshift/rosa/tests/ci/config" | ||
"github.com/openshift/rosa/tests/utils/common" | ||
"github.com/openshift/rosa/tests/utils/log" | ||
) | ||
|
||
// ParseUserData Get user data from resources.json file | ||
func ParseUserData() (*UserData, error) { | ||
var ud *UserData | ||
|
||
udContent, err := common.ReadFileContent(config.Test.UserDataFile) | ||
if err != nil { | ||
log.Logger.Errorf("Error happened when read user data: %s", err.Error()) | ||
return nil, err | ||
} | ||
err = json.Unmarshal([]byte(udContent), &ud) | ||
if err != nil { | ||
log.Logger.Errorf("Error happend when parse resource file data to UserData struct: %s", err.Error()) | ||
return nil, err | ||
} | ||
return ud, err | ||
} | ||
|
||
// ParserClusterDetail Get the cluster info from cluster-detail.json file | ||
func ParserClusterDetail() (*ClusterDetail, error) { | ||
var cd *ClusterDetail | ||
|
||
_, err := os.Stat(config.Test.ClusterDetailFile) | ||
if err != nil { | ||
log.Logger.Warn("Cluster detail file not exists") | ||
return nil, nil | ||
} | ||
cdContent, err := common.ReadFileContent(config.Test.ClusterDetailFile) | ||
if err != nil { | ||
log.Logger.Errorf("Error happened when read cluster detail: %s", err.Error()) | ||
return nil, err | ||
} | ||
err = json.Unmarshal([]byte(cdContent), &cd) | ||
if err != nil { | ||
log.Logger.Errorf("Error happend when parse cluster detail file to ClusterDetail struct: %s", err.Error()) | ||
return nil, err | ||
} | ||
return cd, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters