Skip to content

Commit 8eabf1a

Browse files
committed
OCM-13423 | test: fix ids:56786,73754,38775 and shared-vpc hcp preparation
1 parent e7b8768 commit 8eabf1a

File tree

5 files changed

+59
-61
lines changed

5 files changed

+59
-61
lines changed

tests/ci/data/profiles/rosa-hcp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ profiles:
188188
volume_size: 75
189189
disable_uwm: true
190190
autoscaler_enabled: false
191-
additional_sg_number: 3
191+
additional_sg_number: 0
192192
registries_config: true
193193
allowed_registries: true
194194
account-role:

tests/e2e/hcp_machine_pool_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,7 @@ var _ = Describe("HCP Machine Pool", labels.Feature.Machinepool, func() {
477477
Expect(err).To(HaveOccurred())
478478
Expect(err.Error()).
479479
Should(
480-
ContainSubstring("Replicas+Autoscaling.Min: The total number of compute nodes for a single cluster"))
481-
Expect(err.Error()).Should(ContainSubstring("exceeds the maximum allowed"))
480+
ContainSubstring("should provide an integer number less than or equal to"))
482481

483482
By("with invalid name")
484483
_, err = machinePoolService.CreateMachinePool(clusterID, "anything%^#@", "--replicas", "2")
@@ -506,7 +505,7 @@ var _ = Describe("HCP Machine Pool", labels.Feature.Machinepool, func() {
506505
Expect(err).To(HaveOccurred())
507506
Expect(err.Error()).
508507
Should(
509-
ContainSubstring("Invalid autoscaling range: 6 - 3. 'min_replica' must be less than or equal to 'max_replica'"))
508+
ContainSubstring("max-replicas must be greater or equal to min-replicas"))
510509

511510
By("with min-replicas and max-replicas but without enable-autoscaling")
512511
_, err = machinePoolService.CreateMachinePool(
@@ -527,8 +526,7 @@ var _ = Describe("HCP Machine Pool", labels.Feature.Machinepool, func() {
527526
Expect(err).To(HaveOccurred())
528527
Expect(err.Error()).
529528
Should(
530-
ContainSubstring("Replicas+Autoscaling.Max: The total number of compute nodes for a single cluster"))
531-
Expect(err.Error()).Should(ContainSubstring("exceeds the maximum allowed"))
529+
ContainSubstring("should provide an integer number less than or equal to"))
532530

533531
By("with wrong instance-type")
534532
_, err = machinePoolService.CreateMachinePool(clusterID, "anything", "--replicas", "2", "--instance-type", "wrong")

tests/e2e/test_rosacli_kubelet_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ var _ = Describe("Kubeletconfig on HCP cluster",
359359
Expect(err).To(HaveOccurred())
360360
Expect(out.String()).
361361
Should(ContainSubstring(
362-
"The name must be a lowercase RFC 1123 subdomain."))
362+
"The name must be a lowercase RFC 1123 subdomain"))
363363

364364
By("Create kubeletconfig with invalid pod pids limit value like 123456789")
365365
out, err = kubeletService.CreateKubeletConfig(clusterID,

tests/e2e/test_rosacli_machine_pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ var _ = Describe("Create machinepool",
820820
"--max-replicas", "3",
821821
"--enable-autoscaling")
822822
Expect(err).To(HaveOccurred())
823-
Expect(output.String()).Should(ContainSubstring("'min_replicas' must be less than or equal to 'max_replicas'"))
823+
Expect(output.String()).Should(ContainSubstring("max-replicas must be greater or equal to min-replicas"))
824824

825825
By("Set min-replicas and max-replicas without set --enable-autoscaling")
826826
output, err = rosaClient.MachinePool.CreateMachinePool(

tests/utils/handler/cluster_handler.go

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,59 @@ func (ch *clusterHandler) GenerateClusterCreateFlags() ([]string, error) {
572572
flags = append(flags,
573573
"--subnet-ids", subnetsFlagValue)
574574

575+
if ch.profile.ClusterConfig.SharedVPC {
576+
subnetArns, err := resourcesHandler.PrepareSubnetArns(subnetsFlagValue)
577+
if err != nil {
578+
return flags, err
579+
}
580+
581+
resourceShareName := fmt.Sprintf("%s-%s", sharedVPCRolePrefix, "resource-share")
582+
_, err = resourcesHandler.PrepareResourceShare(resourceShareName, subnetArns)
583+
if err != nil {
584+
return flags, err
585+
}
586+
587+
dnsDomain, err := resourcesHandler.PrepareDNSDomain(ch.profile.ClusterConfig.HCP)
588+
if err != nil {
589+
return flags, err
590+
}
591+
flags = append(flags, "--base-domain", dnsDomain)
592+
if ch.profile.ClusterConfig.HCP {
593+
ingressHostedZoneID, err := resourcesHandler.PrepareHostedZone(
594+
fmt.Sprintf("rosa.%s.%s", clusterName, dnsDomain), vpc.VpcID, true)
595+
if err != nil {
596+
return flags, err
597+
}
598+
flags = append(flags, "--ingress-private-hosted-zone-id", ingressHostedZoneID)
599+
600+
hostedCPInternalHostedZoneID, err := resourcesHandler.PrepareHostedZone(
601+
fmt.Sprintf("%s.hypershift.local", clusterName), vpc.VpcID, true,
602+
)
603+
if err != nil {
604+
return flags, err
605+
}
606+
flags = append(flags, "--hcp-internal-communication-hosted-zone-id", hostedCPInternalHostedZoneID)
607+
} else {
608+
ingressHostedZoneID, err := resourcesHandler.PrepareHostedZone(
609+
fmt.Sprintf("%s.%s", clusterName, dnsDomain), vpc.VpcID, true,
610+
)
611+
if err != nil {
612+
return flags, err
613+
}
614+
flags = append(flags, "--ingress-private-hosted-zone-id", ingressHostedZoneID)
615+
}
616+
617+
ch.clusterConfig.SharedVPC = ch.profile.ClusterConfig.SharedVPC
618+
619+
//HostedCP Shared VPC cluster BYO subnet needs to add tags 'kubernetes.io/role/internal-elb'
620+
//and 'kubernetes.io/role/elb' on public and private subnets on the cluster owner aws account
621+
if ch.profile.ClusterConfig.HCP {
622+
err = resourcesHandler.AddTagsToSharedVPCBYOSubnets(*ch.clusterConfig.Subnets, ch.clusterConfig.Region)
623+
if err != nil {
624+
return flags, err
625+
}
626+
}
627+
}
575628
if ch.profile.ClusterConfig.AdditionalSGNumber != 0 {
576629
securityGroups, err := resourcesHandler.
577630
PrepareAdditionalSecurityGroups(ch.profile.ClusterConfig.AdditionalSGNumber, vpcPrefix)
@@ -627,59 +680,6 @@ func (ch *clusterHandler) GenerateClusterCreateFlags() ([]string, error) {
627680
)
628681

629682
}
630-
if ch.profile.ClusterConfig.SharedVPC {
631-
subnetArns, err := resourcesHandler.PrepareSubnetArns(subnetsFlagValue)
632-
if err != nil {
633-
return flags, err
634-
}
635-
636-
resourceShareName := fmt.Sprintf("%s-%s", sharedVPCRolePrefix, "resource-share")
637-
_, err = resourcesHandler.PrepareResourceShare(resourceShareName, subnetArns)
638-
if err != nil {
639-
return flags, err
640-
}
641-
642-
dnsDomain, err := resourcesHandler.PrepareDNSDomain(ch.profile.ClusterConfig.HCP)
643-
if err != nil {
644-
return flags, err
645-
}
646-
flags = append(flags, "--base-domain", dnsDomain)
647-
if ch.profile.ClusterConfig.HCP {
648-
ingressHostedZoneID, err := resourcesHandler.PrepareHostedZone(
649-
fmt.Sprintf("rosa.%s.%s", clusterName, dnsDomain), vpc.VpcID, true)
650-
if err != nil {
651-
return flags, err
652-
}
653-
flags = append(flags, "--ingress-private-hosted-zone-id", ingressHostedZoneID)
654-
655-
hostedCPInternalHostedZoneID, err := resourcesHandler.PrepareHostedZone(
656-
fmt.Sprintf("%s.hypershift.local", clusterName), vpc.VpcID, true,
657-
)
658-
if err != nil {
659-
return flags, err
660-
}
661-
flags = append(flags, "--hcp-internal-communication-hosted-zone-id", hostedCPInternalHostedZoneID)
662-
} else {
663-
ingressHostedZoneID, err := resourcesHandler.PrepareHostedZone(
664-
fmt.Sprintf("%s.%s", clusterName, dnsDomain), vpc.VpcID, true,
665-
)
666-
if err != nil {
667-
return flags, err
668-
}
669-
flags = append(flags, "--ingress-private-hosted-zone-id", ingressHostedZoneID)
670-
}
671-
672-
ch.clusterConfig.SharedVPC = ch.profile.ClusterConfig.SharedVPC
673-
674-
//HostedCP Shared VPC cluster BYO subnet needs to add tags 'kubernetes.io/role/internal-elb'
675-
//and 'kubernetes.io/role/elb' on public and private subnets on the cluster owner aws account
676-
if ch.profile.ClusterConfig.HCP {
677-
err = resourcesHandler.AddTagsToSharedVPCBYOSubnets(*ch.clusterConfig.Subnets, ch.clusterConfig.Region)
678-
if err != nil {
679-
return flags, err
680-
}
681-
}
682-
}
683683
}
684684
if ch.profile.ClusterConfig.BillingAccount != "" {
685685
flags = append(flags, "--billing-account", ch.profile.ClusterConfig.BillingAccount)

0 commit comments

Comments
 (0)