Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCM-11043 | test: automated case id:76543 #2606

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
28 changes: 28 additions & 0 deletions tests/ci/data/profiles/rosa-hcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,34 @@ profiles:
account-role:
path: "/test/hcp/"
permission_boundary: "arn:aws:iam::aws:policy/AdministratorAccess"
- as: rosa-hcp-ze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this name:rosa-hcp-ze mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add zero_egress to exist profile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rosa-hcp-(zero egress)
I added it as a separate profile since there are restrictions about the version itself.

version: 4.14.38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about other versions? we use latest version usually

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, zero_egress is only supported for 4.14.y versions. Once the GA is released, I can change this to latest

channel_group: stable
region: "us-west-2"
cluster:
multi_az: true
instance_type: ""
hcp: true
sts: true
byo_vpc: true
private: true
additional_principals: false
imdsv2: ""
etcd_encryption: false
autoscale: false
kms_key: false
oidc_config: "managed"
networking: false
proxy_enabled: false
label_enabled: false
tag_enabled: false
zones: ""
registries_config: true
blocked_registries: true
zero_egress: true
account-role:
path: "/test/hcp/"
permission_boundary: "arn:aws:iam::aws:policy/AdministratorAccess"
- as: rosa-hcp-upgrade-z-stream
version: "z-1"
channel_group: stable
Expand Down
31 changes: 31 additions & 0 deletions tests/e2e/hcp_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/openshift/rosa/tests/utils/config"
"github.com/openshift/rosa/tests/utils/constants"
"github.com/openshift/rosa/tests/utils/exec/rosacli"
"github.com/openshift/rosa/tests/utils/helper"
"github.com/openshift/rosa/tests/utils/profilehandler"
)

Expand Down Expand Up @@ -657,4 +658,34 @@ var _ = Describe("HCP cluster testing",
}
}
})

It("create zero-egress HCP cluster - [id:76543]",
labels.High, labels.Runtime.Day1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can move the step:CreateMachinePool in day2 case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though its part of the test case? I know that having a machinepool created on a ZE cluster was an area we wanted tested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the rule, we have day1\day2\destoy ... cases. We will filter the case by orde.So if the case is for day1, it would be better to not contain day2 step. We can move it in day2 case other than ignore the step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I'll remove the mp portion.

func() {
By("Get cluster description")
output, err := clusterService.DescribeCluster(clusterID)
Expect(err).To(BeNil())
clusterDetail, err := clusterService.ReflectClusterDescription(output)
Expect(err).To(BeNil())
Expect(clusterDetail.ZeroEgress).To(Equal("Enabled"))

By("Create a machinepool describe it")
mpID := helper.GenerateRandomName("mp-36293", 2)
output, err = rosaClient.MachinePool.CreateMachinePool(clusterID, mpID,
"--replicas", "1",
"-y",
)
Expect(err).ToNot(HaveOccurred())
textData := rosaClient.Parser.TextData.Input(output).Parse().Tip()
Expect(textData).To(ContainSubstring(
"Machine pool '%s' created successfully on hosted cluster '%s'",
mpID,
clusterID))
_, err = machinePoolService.DescribeMachinePool(clusterID, mpID)
Expect(err).ToNot(HaveOccurred())
defer func() {
By("Remove the machine pool")
rosaClient.MachinePool.DeleteMachinePool(clusterID, mpID)
}()
})
})
1 change: 1 addition & 0 deletions tests/utils/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Encryption struct {

type Properties struct {
ProvisionShardID string `json:"provision_shard_id,omitempty"`
ZeroEgress bool `json:"zero_egress,omitempty"`
}

type Sts struct {
Expand Down
1 change: 1 addition & 0 deletions tests/utils/profilehandler/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type ClusterConfig struct {
AllowedRegistries bool `yaml:"allowed_registries" json:"allowed_registries,omitempty"`
BlockedRegistries bool `yaml:"blocked_registries" json:"blocked_registries,omitempty"`
ManualCreationMode bool `yaml:"manual_creation_mode" json:"manual_creation_mode,omitempty"`
ZeroEgress bool `yaml:"zero_egress" json:"zero_egress,omitempty"`
}

// UserData will record the user data prepared for resource clean up
Expand Down
7 changes: 7 additions & 0 deletions tests/utils/profilehandler/profile_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,13 @@ func GenerateClusterCreateFlags(profile *Profile, client *rosacli.Client) ([]str
}
}

if profile.ClusterConfig.ZeroEgress {
flags = append(flags, "--properties", fmt.Sprintf("zero_egress:%t", profile.ClusterConfig.ZeroEgress))
clusterConfiguration.Properties = &ClusterConfigure.Properties{
ZeroEgress: profile.ClusterConfig.ZeroEgress,
}
}

if profile.ClusterConfig.TagEnabled {
tags := "test-tag:tagvalue,qe-managed:true"
flags = append(flags, "--tags", tags)
Expand Down