-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1573 from thomasmckay/4571-cherry-pick-4644
OCM-4644 | fix: Create cluster - filter classic ROSA account roles
- Loading branch information
Showing
4 changed files
with
132 additions
and
8 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
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
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,61 @@ | ||
package aws | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/service/iam" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Is Account Role Version Compatible", func() { | ||
When("Role isn't an account role", func() { | ||
It("Should return not compatible", func() { | ||
isCompatible, err := isAccountRoleVersionCompatible([]*iam.Tag{}, InstallerAccountRole, "4.14") | ||
Expect(err).To(BeNil()) | ||
Expect(isCompatible).To(Equal(false)) | ||
}) | ||
}) | ||
When("Role OCP version isn't compatible", func() { | ||
It("Should return not compatible", func() { | ||
tagsList := []*iam.Tag{ | ||
{ | ||
Key: aws.String("rosa_openshift_version"), | ||
Value: aws.String("4.13"), | ||
}, | ||
} | ||
isCompatible, err := isAccountRoleVersionCompatible(tagsList, InstallerAccountRole, "4.14") | ||
Expect(err).To(BeNil()) | ||
Expect(isCompatible).To(Equal(false)) | ||
}) | ||
}) | ||
When("Role version is compatible", func() { | ||
It("Should return compatible", func() { | ||
tagsList := []*iam.Tag{ | ||
{ | ||
Key: aws.String("rosa_openshift_version"), | ||
Value: aws.String("4.14"), | ||
}, | ||
} | ||
isCompatible, err := isAccountRoleVersionCompatible(tagsList, InstallerAccountRole, "4.14") | ||
Expect(err).To(BeNil()) | ||
Expect(isCompatible).To(Equal(true)) | ||
}) | ||
}) | ||
When("Role has managed policies, ignores openshift version", func() { | ||
It("Should return compatible", func() { | ||
tagsList := []*iam.Tag{ | ||
{ | ||
Key: aws.String("rosa_openshift_version"), | ||
Value: aws.String("4.12"), | ||
}, | ||
{ | ||
Key: aws.String("rosa_managed_policies"), | ||
Value: aws.String("true"), | ||
}, | ||
} | ||
isCompatible, err := isAccountRoleVersionCompatible(tagsList, InstallerAccountRole, "4.14") | ||
Expect(err).To(BeNil()) | ||
Expect(isCompatible).To(Equal(true)) | ||
}) | ||
}) | ||
}) |