@@ -20,6 +20,7 @@ var _ = Describe("GPU instance support", func() {
2020 instanceSelector * api.InstanceSelector
2121
2222 expectUnsupportedErr bool
23+ expectWarning bool
2324 }
2425
2526 assertValidationError := func (e gpuInstanceEntry , err error ) {
@@ -147,33 +148,52 @@ var _ = Describe("GPU instance support", func() {
147148 output := & bytes.Buffer {}
148149 logger .Writer = output
149150 Expect (api .ValidateNodeGroup (0 , ng , api .NewClusterConfig ())).NotTo (HaveOccurred ())
150- Expect (output .String ()).To (ContainSubstring (api .GPUDriversWarning (ng .AMIFamily )))
151+ if e .expectWarning {
152+ Expect (output .String ()).To (ContainSubstring (api .GPUDriversWarning (mng .AMIFamily )))
153+ } else {
154+ Expect (output .String ()).NotTo (ContainSubstring (api .GPUDriversWarning (mng .AMIFamily )))
155+ }
151156
152157 output = & bytes.Buffer {}
153158 logger .Writer = output
154159 Expect (api .ValidateManagedNodeGroup (0 , mng )).NotTo (HaveOccurred ())
155- Expect (output .String ()).To (ContainSubstring (api .GPUDriversWarning (mng .AMIFamily )))
160+ if e .expectWarning {
161+ Expect (output .String ()).To (ContainSubstring (api .GPUDriversWarning (mng .AMIFamily )))
162+ } else {
163+ Expect (output .String ()).NotTo (ContainSubstring (api .GPUDriversWarning (mng .AMIFamily )))
164+ }
156165 },
166+ Entry ("Windows without GPU instances" , gpuInstanceEntry {
167+ amiFamily : api .NodeImageFamilyUbuntu2004 ,
168+ instanceSelector : & api.InstanceSelector {
169+ VCPUs : 4 ,
170+ GPUs : newInt (0 ),
171+ },
172+ }),
157173 Entry ("Windows with explicit GPU instance" , gpuInstanceEntry {
158174 amiFamily : api .NodeImageFamilyWindowsServer2019FullContainer ,
159175 gpuInstanceType : "g4dn.xlarge" ,
176+ expectWarning : true ,
160177 }),
161178 Entry ("Windows with implicit GPU instance" , gpuInstanceEntry {
162179 amiFamily : api .NodeImageFamilyWindowsServer2022CoreContainer ,
163180 instanceSelector : & api.InstanceSelector {
164181 VCPUs : 4 ,
165182 },
183+ expectWarning : true ,
166184 }),
167185 Entry ("Ubuntu with explicit GPU instance" , gpuInstanceEntry {
168186 amiFamily : api .NodeImageFamilyUbuntu1804 ,
169187 gpuInstanceType : "g4dn.xlarge" ,
188+ expectWarning : true ,
170189 }),
171190 Entry ("Ubuntu with implicit GPU instance" , gpuInstanceEntry {
172191 amiFamily : api .NodeImageFamilyUbuntu2004 ,
173192 instanceSelector : & api.InstanceSelector {
174193 VCPUs : 4 ,
175194 GPUs : newInt (2 ),
176195 },
196+ expectWarning : true ,
177197 }),
178198 )
179199
0 commit comments