From 394b6f54fc0dd81ab799402814e55b854d120a67 Mon Sep 17 00:00:00 2001 From: Jericho Keyne Date: Wed, 1 Jul 2026 16:52:05 -0400 Subject: [PATCH] ROSAENG-60640 | test: Fixing day1-negative test cases --- tests/e2e/test_rosacli_account_roles.go | 2 +- tests/e2e/test_rosacli_cluster.go | 51 ++++++++++++--------- tests/utils/exec/rosacli/cluster_service.go | 2 +- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/tests/e2e/test_rosacli_account_roles.go b/tests/e2e/test_rosacli_account_roles.go index 2e6ee2b1d6..bd865dd157 100644 --- a/tests/e2e/test_rosacli_account_roles.go +++ b/tests/e2e/test_rosacli_account_roles.go @@ -504,7 +504,7 @@ var _ = Describe("Edit account roles", labels.Feature.AccountRoles, func() { Expect(textData).To(ContainSubstring("WARN: There are no hosted CP account roles to be deleted")) }) It("create/delete classic account roles with managed policies - [id:57408]", - labels.Critical, labels.Runtime.OCMResources, + labels.Critical, labels.Runtime.OCMResources, labels.Exclude, func() { var ( diff --git a/tests/e2e/test_rosacli_cluster.go b/tests/e2e/test_rosacli_cluster.go index 5973c32108..42b68c75e6 100644 --- a/tests/e2e/test_rosacli_cluster.go +++ b/tests/e2e/test_rosacli_cluster.go @@ -2486,35 +2486,49 @@ var _ = Describe("HCP cluster creation negative testing", var ( rosaClient *rosacli.Client clusterService rosacli.ClusterService - profilesMap map[string]*handler.Profile - profile *handler.Profile + customProfile *handler.Profile command string rosalCommand config.Command clusterHandler handler.ClusterHandler err error ) BeforeEach(func() { - By("Init the client") rosaClient = rosacli.NewClient() clusterService = rosaClient.Cluster - // Get a random profile - profilesMap = handler.ParseProfilesByFile(path.Join(ciConfig.Test.YAMLProfilesDir, "rosa-hcp.yaml")) - profilesNames := make([]string, 0, len(profilesMap)) - for k := range profilesMap { - profilesNames = append(profilesNames, k) + By("Prepare custom profile") + customProfile = &handler.Profile{ + ClusterConfig: &handler.ClusterConfig{ + HCP: true, + MultiAZ: true, + STS: true, + OIDCConfig: "managed", + NetworkingSet: true, + BYOVPC: true, + Zones: "", + Autoscale: false, + PrivateLink: false, + DefaultIngressPrivate: false, + }, + AccountRoleConfig: &handler.AccountRoleConfig{ + Path: "", + PermissionBoundary: "", + }, + Version: "y-1", + ChannelGroup: "stable", + Region: constants.CommonAWSRegion, } - profile = profilesMap[profilesNames[helper.RandomInt(len(profilesNames))]] - profile.NamePrefix = constants.DefaultNamePrefix - clusterHandler, err = handler.NewTempClusterHandler(rosaClient, profile) + customProfile.NamePrefix = constants.DefaultNamePrefix + clusterHandler, err = handler.NewTempClusterHandler(rosaClient, customProfile) Expect(err).To(BeNil()) + By("Init the cluster id and testing cluster name") By("Prepare creation command") flags, err := clusterHandler.GenerateClusterCreateFlags() Expect(err).To(BeNil()) - command = "rosa create cluster --cluster-name " + profile.ClusterConfig.Name + " " + strings.Join(flags, " ") + command = "rosa create cluster --cluster-name " + customProfile.ClusterConfig.Name + " " + strings.Join(flags, " ") rosalCommand = config.GenerateCommand(command) }) @@ -2714,27 +2728,24 @@ var _ = Describe("HCP cluster creation negative testing", "ERR: External authentication configuration is only supported for a Hosted Control Plane cluster.")) By("Create HCP cluster with --external-auth-providers-enabled and cluster version lower than 4.15") - cg := rosalCommand.GetFlagValue("--channel-group", true) - if cg == "" { - cg = rosacli.VersionChannelGroupStable - } + cg := rosacli.VersionChannelGroupStable versionList, err := rosaClient.Version.ListAndReflectVersions(cg, rosalCommand.CheckFlagExist("--hosted-cp")) Expect(err).To(BeNil()) Expect(versionList).ToNot(BeNil()) previousVersionsList, err := versionList.FindNearestBackwardMinorVersion("4.14", 0, true) Expect(err).ToNot(HaveOccurred()) foundVersion := previousVersionsList.Version + replacingFlags := map[string]string{ "-c": clusterName, "--cluster-name": clusterName, "--domain-prefix": clusterName, "--version": foundVersion, + "--channel-group": cg, } rosalCommand.ReplaceFlagValue(replacingFlags) if !rosalCommand.CheckFlagExist("--external-auth-providers-enabled") { - rosalCommand.AddFlags("--dry-run", "--external-auth-providers-enabled", "-y") - } else { - rosalCommand.AddFlags("--dry-run", "-y") + rosalCommand.AddFlags("--external-auth-providers-enabled") } output, err = rosaClient.Runner.RunCMD(strings.Split(rosalCommand.GetFullCommand(), " ")) Expect(err).To(HaveOccurred()) @@ -2840,7 +2851,6 @@ var _ = Describe("HCP cluster creation negative testing", } rosalCommand.ReplaceFlagValue(replacingFlags) rosalCommand.AddFlags("--dry-run", "-y") - log.Logger.Debug(profile.Name) log.Logger.Debug(strings.Split(rosalCommand.GetFullCommand(), " ")) By("Create classic cluster with audit log arn") @@ -2974,7 +2984,6 @@ var _ = Describe("HCP cluster creation negative testing", } rosalCommand.ReplaceFlagValue(replacingFlags) rosalCommand.AddFlags("--dry-run", "-y") - log.Logger.Debug(profile.Name) log.Logger.Debug(strings.Split(rosalCommand.GetFullCommand(), " ")) rosalCommand.AddFlags("--registry-config-allowed-registries-for-import", "test.com:invalid") diff --git a/tests/utils/exec/rosacli/cluster_service.go b/tests/utils/exec/rosacli/cluster_service.go index bf3ae31eef..3aec6f1fa2 100644 --- a/tests/utils/exec/rosacli/cluster_service.go +++ b/tests/utils/exec/rosacli/cluster_service.go @@ -245,7 +245,7 @@ func (c *clusterService) List() (bytes.Buffer, error) { } func (c *clusterService) CreateDryRun(clusterName string, flags ...string) (bytes.Buffer, error) { - combflags := append([]string{"-c", clusterName, "--dry-run"}, flags...) + combflags := append([]string{"-c", clusterName, "--dry-run", "--mode=auto", "--yes"}, flags...) createDryRun := c.client.Runner. Cmd("create", "cluster"). CmdFlags(combflags...)