@@ -126,6 +126,15 @@ describe('MaaS Deployment Wizard', () => {
126126 { path : { namespace : 'test-project' , name : 'test-llm-inference-service' } } ,
127127 { message : 'Deleted successfully' } ,
128128 ) . as ( 'deleteMaaSModelRef' ) ;
129+ cy . interceptOdh (
130+ 'PUT /maas/api/v1/maasmodel/:namespace/:name' ,
131+ { path : { namespace : '*' , name : '*' } } ,
132+ mockMaaSModelRef ( {
133+ name : 'test-maas-model-ref' ,
134+ namespace : 'test-project' ,
135+ modelRef : { name : 'test-llm-inference-service' , kind : 'LLMInferenceService' } ,
136+ } ) ,
137+ ) . as ( 'updateMaaSModelRef' ) ;
129138 } ;
130139
131140 it ( 'should create an LLMD deployment with MaaS enabled and create a MaaSModelRef' , ( ) => {
@@ -165,6 +174,12 @@ describe('MaaS Deployment Wizard', () => {
165174 // Submit and verify MaaS-specific annotations and gateway refs
166175 modelServingWizard . findSubmitButton ( ) . click ( ) ;
167176
177+ cy . wait ( '@createMaaSModelRef' ) . then ( ( interception ) => {
178+ expect ( interception . request . url ) . to . include ( '?dryRun=true' ) ;
179+ expect ( interception . request . body . name ) . to . equal ( 'test-llm-inference-service' ) ;
180+ expect ( interception . request . body . namespace ) . to . equal ( 'test-project' ) ;
181+ } ) ;
182+
168183 cy . wait ( '@createLLMInferenceService' ) . then ( ( interception ) => {
169184 expect ( interception . request . url ) . to . include ( '?dryRun=All' ) ;
170185
@@ -179,16 +194,66 @@ describe('MaaS Deployment Wizard', () => {
179194 cy . wait ( '@createLLMInferenceService' ) ;
180195 cy . get ( '@createLLMInferenceService.all' ) . should ( 'have.length' , 2 ) ;
181196 cy . wait ( '@createMaaSModelRef' ) . then ( ( interception ) => {
197+ expect ( interception . request . url ) . not . to . include ( '?dryRun=true' ) ;
182198 expect ( interception . request . body . name ) . to . equal ( 'test-llm-inference-service' ) ;
183199 expect ( interception . request . body . namespace ) . to . equal ( 'test-project' ) ;
184200 expect ( interception . request . body . displayName ) . to . equal ( 'Test LLM Inference Service' ) ;
185201 expect ( interception . request . body . description ) . to . equal (
186202 'Test LLM Inference Service Description' ,
187203 ) ;
188- expect ( interception . request . body . modelRef ) . to . deep . equal ( {
189- name : 'test-llm-inference-service' ,
190- kind : 'LLMInferenceService' ,
191- } ) ;
204+ } ) ;
205+ cy . get ( '@createMaaSModelRef.all' ) . should ( 'have.length' , 2 ) ;
206+ } ) ;
207+ it ( 'should update the MaaSModelRef when editing an existing deployment' , ( ) => {
208+ initMaaSDeploymentIntercepts ( ) ;
209+ const savedURIModel = mockLLMInferenceServiceK8sResource ( {
210+ isMaaS : true ,
211+ replicas : 2 ,
212+ } ) ;
213+ cy . interceptK8sList (
214+ { model : LLMInferenceServiceModel , ns : 'test-project' } ,
215+ mockK8sResourceList ( [ savedURIModel ] ) ,
216+ ) ;
217+ modelServingGlobal . visit ( 'test-project' ) ;
218+ modelServingGlobal . getModelRow ( 'Test LLM Inference Service' ) . findKebabAction ( 'Edit' ) . click ( ) ;
219+ modelServingWizardEdit
220+ . findModelLocationSelectOption ( 'Existing connection' )
221+ . should ( 'exist' )
222+ . click ( ) ;
223+ modelServingWizardEdit . findNextButton ( ) . should ( 'be.enabled' ) . click ( ) ;
224+ modelServingWizardEdit . findModelDeploymentNameInput ( ) . clear ( ) . type ( 'test-llmd-model-2' ) ;
225+ modelServingWizardEdit . findModelDeploymentDescriptionInput ( ) . type ( 'test-llmd-description-2' ) ;
226+ hardwareProfileSection . findSelect ( ) . should ( 'exist' ) ;
227+ hardwareProfileSection . findSelect ( ) . should ( 'contain.text' , 'Small' ) ;
228+ hardwareProfileSection . selectProfile (
229+ 'Large Profile Compatible CPU: Request = 4 Cores; Limit = 4 Cores; Memory: Request = 8 GiB; Limit = 8 GiB' ,
230+ ) ;
231+ modelServingWizardEdit . findNextButton ( ) . should ( 'be.enabled' ) . click ( ) ;
232+ maasWizardField . findSaveAsMaaSCheckbox ( ) . should ( 'exist' ) . should ( 'be.checked' ) ;
233+ modelServingWizardEdit . findNextButton ( ) . should ( 'be.enabled' ) . click ( ) ;
234+ modelServingWizardEdit . findSubmitButton ( ) . click ( ) ;
235+ cy . wait ( '@updateMaaSModelRef' ) . then ( ( interception ) => {
236+ expect ( interception . request . url ) . to . include ( '?dryRun=true' ) ;
237+ expect ( interception . request . url ) . to . include ( '/test-project/test-llm-inference-service' ) ;
238+ expect ( interception . request . body . displayName ) . to . equal ( 'test-llmd-model-2' ) ;
239+ expect ( interception . request . body . description ) . to . equal ( 'test-llmd-description-2' ) ;
240+ } ) ;
241+ cy . wait ( '@updateLLMInferenceService' ) . then ( ( interception ) => {
242+ expect ( interception . request . url ) . to . include ( '?dryRun=All' ) ;
243+ } ) ;
244+
245+ cy . wait ( '@updateLLMInferenceService' ) . then ( ( interception ) => {
246+ expect ( interception . request . url ) . not . to . include ( '?dryRun=All' ) ;
247+ } ) ;
248+
249+ cy . get ( '@updateLLMInferenceService.all' ) . then ( ( interceptions ) => {
250+ expect ( interceptions ) . to . have . length ( 2 ) ;
251+ } ) ;
252+ cy . wait ( '@updateMaaSModelRef' ) . then ( ( interception ) => {
253+ expect ( interception . request . url ) . not . to . include ( '?dryRun=true' ) ;
254+ } ) ;
255+ cy . get ( '@updateMaaSModelRef.all' ) . then ( ( interceptions ) => {
256+ expect ( interceptions ) . to . have . length ( 2 ) ;
192257 } ) ;
193258 } ) ;
194259 it ( 'should delete the MaaSModelRef when the MaaS checkbox is unchecked' , ( ) => {
@@ -227,6 +292,10 @@ describe('MaaS Deployment Wizard', () => {
227292 maasWizardField . findSaveAsMaaSCheckbox ( ) . should ( 'not.be.checked' ) ;
228293 modelServingWizardEdit . findNextButton ( ) . should ( 'be.enabled' ) . click ( ) ;
229294 modelServingWizardEdit . findSubmitButton ( ) . click ( ) ;
295+ cy . wait ( '@deleteMaaSModelRef' ) . then ( ( interception ) => {
296+ expect ( interception . request . url ) . to . include ( '?dryRun=true' ) ;
297+ expect ( interception . request . url ) . to . include ( '/test-project/test-llm-inference-service' ) ;
298+ } ) ;
230299 cy . wait ( '@updateLLMInferenceService' ) . then ( ( interception ) => {
231300 expect ( interception . request . url ) . to . include ( '?dryRun=All' ) ;
232301 expect ( interception . request . body . spec . router . gateway . refs ) . to . deep . equal ( undefined ) ;
@@ -239,8 +308,60 @@ describe('MaaS Deployment Wizard', () => {
239308 cy . get ( '@updateLLMInferenceService.all' ) . then ( ( interceptions ) => {
240309 expect ( interceptions ) . to . have . length ( 2 ) ;
241310 } ) ;
242- cy . wait ( '@deleteMaaSModelRef' ) . then ( ( interception ) => {
243- expect ( interception . request . url ) . to . include ( '/test-project/test-llm-inference-service' ) ;
244- } ) ;
311+ cy . get ( '@deleteMaaSModelRef.all' ) . should ( 'have.length' , 2 ) ;
312+ } ) ;
313+ it ( 'should show an error if the MaaSModelRef dry run fails' , ( ) => {
314+ initMaaSDeploymentIntercepts ( ) ;
315+ cy . intercept (
316+ { method : 'POST' , url : '**/maas/api/v1/maasmodel*' , query : { dryRun : 'true' } } ,
317+ {
318+ statusCode : 409 ,
319+ body : {
320+ error : {
321+ code : '409' ,
322+ message : "MaaSModelRef 'test-llm-inference-service' already exists" ,
323+ } ,
324+ } ,
325+ } ,
326+ ) . as ( 'createMaaSModelRefDryRun' ) ;
327+
328+ // Navigate to wizard and set up basic deployment
329+ modelServingGlobal . visit ( 'test-project' ) ;
330+ modelServingGlobal . findDeployModelButton ( ) . click ( ) ;
331+
332+ // Quick setup: Model source and deployment
333+ modelServingWizard . findModelLocationSelectOption ( ModelLocationSelectOption . EXISTING ) . click ( ) ;
334+ modelServingWizard . findExistingConnectionValue ( ) . should ( 'have.value' , 'test-s3-secret' ) ;
335+ modelServingWizard . findModelTypeSelectOption ( ModelTypeLabel . GENERATIVE ) . click ( ) ;
336+ modelServingWizard . findNextButton ( ) . click ( ) ;
337+
338+ modelServingWizard . findModelDeploymentNameInput ( ) . type ( 'test-llm-inference-service' ) ;
339+ modelServingWizard
340+ . findModelDeploymentDescriptionInput ( )
341+ . type ( 'Test LLM Inference Service Description' ) ;
342+ modelServingWizard . findServingRuntimeTemplateSearchSelector ( ) . click ( ) ;
343+ modelServingWizard . findGlobalScopedTemplateOption ( 'Distributed inference with llm-d' ) . click ( ) ;
344+ modelServingWizard . findNextButton ( ) . click ( ) ;
345+
346+ // Focus on MaaS feature testing
347+ // uncheck token auth to simplify test
348+ modelServingWizard . findTokenAuthenticationCheckbox ( ) . click ( ) ;
349+
350+ // Verify MaaS checkbox is unchecked by default
351+ maasWizardField . findSaveAsMaaSCheckbox ( ) . should ( 'exist' ) . should ( 'not.be.checked' ) ;
352+
353+ // Check the MaaS checkbox
354+ maasWizardField . findSaveAsMaaSCheckbox ( ) . click ( ) ;
355+ maasWizardField . findSaveAsMaaSCheckbox ( ) . should ( 'be.checked' ) ;
356+
357+ modelServingWizard . findNextButton ( ) . should ( 'be.enabled' ) . click ( ) ;
358+
359+ // Submit and verify MaaS-specific annotations and gateway refs
360+ modelServingWizard . findSubmitButton ( ) . click ( ) ;
361+ cy . wait ( '@createMaaSModelRefDryRun' ) ;
362+ // Wizard stayed open and shows the error
363+ modelServingWizard . findErrorMessageAlert ( ) . should ( 'be.visible' ) . contains ( 'Error' ) ;
364+ // no LLMInferenceService should be created
365+ cy . get ( '@createLLMInferenceService.all' ) . should ( 'have.length' , 0 ) ;
245366 } ) ;
246367} ) ;
0 commit comments