@@ -129,13 +129,32 @@ var _ = Describe("ValidateProviderSpecNSecret", func() {
129129 "eu01-2" ,
130130 "eu02-1" ,
131131 "eu02-4" ,
132+ "eu01-m" ,
133+ "eu02-m" ,
132134 }
133135 for _ , az := range testCases {
134136 providerSpec .AvailabilityZone = az
135137 errors := ValidateProviderSpecNSecret (providerSpec , secret )
136138 Expect (errors ).To (BeEmpty (), "AvailabilityZone %q should be valid" , az )
137139 }
138140 })
141+
142+ It ("should fail with invalid availabilityZone formats" , func () {
143+ invalidCases := []string {
144+ "eu01-a" , // letter other than 'm'
145+ "eu01-m1" , // 'm' followed by digit
146+ "eu01" , // missing dash and suffix
147+ "eu01-" , // missing suffix
148+ "-1" , // missing prefix
149+ "eu01-mm" , // multiple letters
150+ }
151+ for _ , az := range invalidCases {
152+ providerSpec .AvailabilityZone = az
153+ errors := ValidateProviderSpecNSecret (providerSpec , secret )
154+ Expect (errors ).NotTo (BeEmpty (), "AvailabilityZone %q should be invalid" , az )
155+ Expect (errors [0 ].Error ()).To (ContainSubstring ("invalid format" ))
156+ }
157+ })
139158 })
140159
141160 Context ("AffinityGroup validation" , func () {
0 commit comments