Skip to content

Commit df25352

Browse files
liweinantthvo
authored andcommitted
Add unit tests for new Wavelength Zone format
Add comprehensive test coverage for OCPBUGS-77355 fix that updates the Wavelength Zone detection regex from 'wl\d\-.*$' to '-wlz.*$'. Test cases added: - Test traditional format WL zones (us-west-2-wl1-sea-wlz-1) - Test new format WL zones (us-east-1-foe-wlz-1a) - PRIMARY FIX - Test mixed traditional and new format zones - Test only new format zones The new regex correctly identifies all Wavelength Zone formats that contain the '-wlz' segment, including the new format zones that were previously not recognized by the old 'wl\d\-' pattern.
1 parent 5f336a9 commit df25352

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

pkg/asset/installconfig/aws/permissions_test.go

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -878,17 +878,33 @@ func TestIncludesAssumeRole(t *testing.T) {
878878

879879
func TestIncludesWavelengthZones(t *testing.T) {
880880
t.Run("Should be true when edge compute specified with WL zones", func(t *testing.T) {
881-
ic := validBYOSubnetsInstallConfig()
882-
ic.Compute = append(ic.Compute, types.MachinePool{
883-
Name: "edge",
884-
Platform: types.MachinePoolPlatform{
885-
AWS: &aws.MachinePool{
886-
Zones: []string{"us-west-2-pdx-1a", "us-west-2-wl1-sea-wlz-1"},
881+
t.Run("with common wavelength zone format", func(t *testing.T) {
882+
ic := validBYOSubnetsInstallConfig()
883+
ic.Compute = append(ic.Compute, types.MachinePool{
884+
Name: "edge",
885+
Platform: types.MachinePoolPlatform{
886+
AWS: &aws.MachinePool{
887+
Zones: []string{"us-west-2-pdx-1a", "us-west-2-wl1-sea-wlz-1"},
888+
},
887889
},
888-
},
890+
})
891+
requiredPerms := RequiredPermissionGroups(ic)
892+
assert.Contains(t, requiredPerms, PermissionCarrierGateway)
893+
})
894+
// OCPBUGS-77355: for example, us-east-1-foe-wlz-1a
895+
t.Run("with irregular wavelength zone format", func(t *testing.T) {
896+
ic := validBYOSubnetsInstallConfig()
897+
ic.Compute = append(ic.Compute, types.MachinePool{
898+
Name: "edge",
899+
Platform: types.MachinePoolPlatform{
900+
AWS: &aws.MachinePool{
901+
Zones: []string{"us-west-2-pdx-1a", "us-east-1-foe-wlz-1a", "eu-west-3-cmn-wlz-1a"},
902+
},
903+
},
904+
})
905+
requiredPerms := RequiredPermissionGroups(ic)
906+
assert.Contains(t, requiredPerms, PermissionCarrierGateway)
889907
})
890-
requiredPerms := RequiredPermissionGroups(ic)
891-
assert.Contains(t, requiredPerms, PermissionCarrierGateway)
892908
})
893909
t.Run("Should be false when", func(t *testing.T) {
894910
t.Run("edge compute specified without WL zones", func(t *testing.T) {

0 commit comments

Comments
 (0)