From 6b01ca46152a91341b50ac95d4bec1d76bae9ad5 Mon Sep 17 00:00:00 2001 From: Jericho Keyne Date: Wed, 28 Aug 2024 16:20:57 -0400 Subject: [PATCH] OCM-9780 | test: automated id:65900,id:76481 install with use-local-credentials will work --- tests/ci/data/profiles/rosa-classic.yaml | 29 ++++++++++++++++++- tests/e2e/test_rosacli_cluster.go | 13 +++++++++ tests/e2e/test_rosacli_cluster_post.go | 9 +++++- tests/utils/profilehandler/interface.go | 1 + tests/utils/profilehandler/profile_handler.go | 5 ++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/tests/ci/data/profiles/rosa-classic.yaml b/tests/ci/data/profiles/rosa-classic.yaml index da2b32e493..2fcdc7da49 100644 --- a/tests/ci/data/profiles/rosa-classic.yaml +++ b/tests/ci/data/profiles/rosa-classic.yaml @@ -214,4 +214,31 @@ profiles: oidc_config: "" shared_vpc: false imdsv2: "optional" - admin_enabled: false \ No newline at end of file + admin_enabled: false +- as: rosa-non-sts-local-creds + version: latest + channel_group: candidate + region: "us-east-1" + cluster: + multi_az: true + instance_type: "" + hcp: false + sts: false + byo_vpc: false + private_link: false + private: false + etcd_encryption: false + autoscale: false + kms_key: false + networking: false + proxy_enabled: false + label_enabled: false + zones: "us-east-1a,us-east-1b,us-east-1c" + tag_enabled: false + etcd_kms: false + fips: false + oidc_config: "" + shared_vpc: false + imdsv2: "optional" + admin_enabled: true + use_local_credentials: true \ No newline at end of file diff --git a/tests/e2e/test_rosacli_cluster.go b/tests/e2e/test_rosacli_cluster.go index 2c4e932d50..5a58fe8db1 100644 --- a/tests/e2e/test_rosacli_cluster.go +++ b/tests/e2e/test_rosacli_cluster.go @@ -1280,6 +1280,19 @@ var _ = Describe("Classic cluster creation validation", Expect(errorOutput.String()).To(ContainSubstring("etcd encryption cannot be disabled on clusters with FIPS mode")) }) + It("validate use-local-credentials won't work with sts - [id:76481]", + labels.Medium, labels.Runtime.Day1Negative, + func() { + clusterName := "ocp-76481" + + By("Create cluster with use-local-credentials flag but with sts") + errorOutput, err := clusterService.CreateDryRun( + clusterName, "--use-local-credentials", "--sts", "--mode=auto", "-y", + ) + Expect(err).NotTo(BeNil()) + Expect(errorOutput.String()).To(ContainSubstring("Local credentials are not supported for STS clusters")) + }) + It("Create rosa cluster with additional security groups will validate well via rosacli - [id:68971]", labels.Medium, labels.Runtime.Day1Negative, func() { diff --git a/tests/e2e/test_rosacli_cluster_post.go b/tests/e2e/test_rosacli_cluster_post.go index f4ecc6c182..ff97f80e5e 100644 --- a/tests/e2e/test_rosacli_cluster_post.go +++ b/tests/e2e/test_rosacli_cluster_post.go @@ -548,7 +548,14 @@ var _ = Describe("Healthy check", } }) - + It("with use-local-credentials will work - [id:65900]", labels.Runtime.Day1Post, labels.High, + func() { + By("Check that the cluster was installed with the right profile") + jsonData, err := clusterService.GetJSONClusterDescription(clusterID) + Expect(jsonData.DigBool("properties", "use_local_credentials")).To(Equal(profile.ClusterConfig.UseLocalCredentials)) + Expect(err).ToNot(HaveOccurred()) + Expect(jsonData.DigBool("properties", "use_local_credentials")).To(BeTrue()) + }) It("with proxy set will work - [id:45502]", labels.Runtime.Day1Post, labels.Critical, func() { By("Check the help message of proxy") diff --git a/tests/utils/profilehandler/interface.go b/tests/utils/profilehandler/interface.go index 9da9108886..440dacb496 100644 --- a/tests/utils/profilehandler/interface.go +++ b/tests/utils/profilehandler/interface.go @@ -57,6 +57,7 @@ type ClusterConfig struct { SharedVPC bool `yaml:"shared_vpc,omitempty" json:"shared_vpc,omitempty"` TagEnabled bool `yaml:"tag_enabled,omitempty" json:"tag_enabled,omitempty"` NetworkType string `yaml:"network_type,omitempty" json:"network_type,omitempty"` + UseLocalCredentials bool `yaml:"use_local_credentials,omitempty" json:"use_local_credentials,omitempty"` } // UserData will record the user data prepared for resource clean up diff --git a/tests/utils/profilehandler/profile_handler.go b/tests/utils/profilehandler/profile_handler.go index d7ca4c69dc..0ae7446be7 100644 --- a/tests/utils/profilehandler/profile_handler.go +++ b/tests/utils/profilehandler/profile_handler.go @@ -180,6 +180,11 @@ func GenerateClusterCreateFlags(profile *Profile, client *rosacli.Client) ([]str "--domain-prefix", helper.TrimNameByLength(clusterName, ocm.MaxClusterDomainPrefixLength), ) } + if profile.ClusterConfig.UseLocalCredentials { + flags = append(flags, + "--use-local-credentials", + ) + } if profile.ClusterConfig.STS { var accRoles *rosacli.AccountRolesUnit var oidcConfigID string