Skip to content

Commit

Permalink
OCM-10628 | ci: Make NAME_PREFIX required for cluster creation
Browse files Browse the repository at this point in the history
  • Loading branch information
xueli181114 committed Sep 9, 2024
1 parent 96cc905 commit 19d46e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ For the test cases, we need `$ make install` to make the rosa command line insta

2. Export the profile name as an environment variable
* `$ export TEST_PROFILE=<PROFILE NAME>`
3. Export the name prefix of the cluster and resources created, no longer than 15 chars.
* `$ export NAME_PREFIX=<your alias>`

3. Create cluster according to the profile configuration
4. Create cluster according to the profile configuration
* `$ ginkgo run --label-filter day1 tests/e2e --timeout 2h`

4. Wait for the cluster preparation finished
5. Wait for the cluster preparation finished

> [!CAUTION]
> **The profiles with a _TODO_ is not supported yet**
Expand All @@ -131,8 +133,8 @@ For the test cases, we need `$ make install` to make the rosa command line insta

This feature allows for running tests through a case filter to simulate CI. Anyone can customize the case label filter to select the specific cases that would be run.

1. To declare the cluster id, use the below variable
* ```$ export CLUSTER_ID=<cluster_id>```
1. To declare the cluster profile again, use the below variable
* `$ export TEST_PROFILE=<PROFILE NAME>`

2. Run cases with the profile
* Running cases based on label filter which to simulate CI jobs
Expand Down
8 changes: 4 additions & 4 deletions tests/utils/profilehandler/profile_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ func LoadProfileYamlFile(profileName string) *Profile {
log.Logger.Infof("Loaded cluster profile configuration from original account-roles %s : %v",
profileName, *p.AccountRoleConfig)
}

if p.NamePrefix == "" {
p.NamePrefix = con.DefaultNamePrefix
}
return p
}

Expand Down Expand Up @@ -68,6 +64,7 @@ func LoadProfileYamlFileByENV() *Profile {
config.Test.GlobalENV.NamePrefix)
profile.NamePrefix = config.Test.GlobalENV.NamePrefix
}

if config.Test.GlobalENV.ComputeMachineType != "" {
log.Logger.Infof("Got global env settings for INSTANCE_TYPE, overwritten the profile setting with value %s",
config.Test.GlobalENV.ComputeMachineType)
Expand Down Expand Up @@ -117,6 +114,9 @@ func GenerateClusterCreateFlags(profile *Profile, client *rosacli.Client) ([]str
if profile.ClusterConfig.NameLegnth == 0 {
profile.ClusterConfig.NameLegnth = con.DefaultNameLength //Set to a default value when it is not set
}
if profile.NamePrefix == "" {
panic("The profile name prefix is empty. Please set with env variable NAME_PREFIX")
}
clusterName := PreparePrefix(profile.NamePrefix, profile.ClusterConfig.NameLegnth)
profile.ClusterConfig.Name = clusterName
var clusterConfiguration = new(ClusterConfigure.ClusterConfig)
Expand Down

0 comments on commit 19d46e7

Please sign in to comment.