@@ -286,6 +286,201 @@ describe('luis:build update application succeed when utterances added', () => {
286286 } )
287287} )
288288
289+ describe ( 'luis:build update application succeed when only publishing mode changes(Production slot to directVersionPublish mode)' , ( ) => {
290+ const existingLuisApp = require ( './../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json' )
291+ before ( function ( ) {
292+ nock ( 'https://westus.api.cognitive.microsoft.com' )
293+ . get ( uri => uri . includes ( 'apps' ) )
294+ . reply ( 200 , [ {
295+ name : 'test(development)-sandwich.en-us.lu' ,
296+ id : 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5' ,
297+ endpoints : {
298+ PRODUCTION : {
299+ versionId : '0.1'
300+ }
301+ }
302+ } ] )
303+
304+ nock ( 'https://westus.api.cognitive.microsoft.com' )
305+ . get ( uri => uri . includes ( 'apps' ) )
306+ . reply ( 200 , {
307+ name : 'test(development)-sandwich.en-us.lu' ,
308+ id : 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5' ,
309+ activeVersion : '0.1'
310+ } )
311+
312+ nock ( 'https://westus.api.cognitive.microsoft.com' )
313+ . get ( uri => uri . includes ( 'export' ) )
314+ . reply ( 200 , existingLuisApp )
315+
316+ nock ( 'https://westus.api.cognitive.microsoft.com' )
317+ . post ( uri => uri . includes ( 'train' ) )
318+ . reply ( 202 , {
319+ statusId : 2 ,
320+ status : 'UpToDate'
321+ } )
322+
323+ nock ( 'https://westus.api.cognitive.microsoft.com' )
324+ . get ( uri => uri . includes ( 'train' ) )
325+ . reply ( 200 , [ {
326+ modelId : '99999' ,
327+ details : {
328+ statusId : 0 ,
329+ status : 'Success' ,
330+ exampleCount : 0
331+ }
332+ } ] )
333+
334+ nock ( 'https://westus.api.cognitive.microsoft.com' )
335+ . post ( uri => uri . includes ( 'publish' ) )
336+ . reply ( 201 , {
337+ versionId : '0.1' ,
338+ isStaging : false
339+ } )
340+ } )
341+
342+ test
343+ . stdout ( )
344+ . command ( [ 'luis:build' , '--in' , './test/fixtures/testcases/lubuild/sandwich/lufiles/sandwich.en-us.lu' , '--authoringKey' , uuidv1 ( ) , '--botName' , 'test' , '--log' , '--suffix' , 'development' , '--directVersionPublish' ] )
345+ . it ( 'should update a luis application when only publishing mode changes(Production slot to directVersionPublish mode)' , ctx => {
346+ expect ( ctx . stdout ) . to . contain ( 'Handling applications...' )
347+ expect ( ctx . stdout ) . to . contain ( 'training version=0.1' )
348+ expect ( ctx . stdout ) . to . contain ( 'waiting for training for version=0.1' )
349+ expect ( ctx . stdout ) . to . contain ( 'publishing version=0.1' )
350+ expect ( ctx . stdout ) . to . contain ( 'publishing finished for directVersionPublish mode' )
351+ } )
352+ } )
353+
354+ describe ( 'luis:build update application succeed when only publishing mode changes(directVersionPublish mode to Production slot)' , ( ) => {
355+ const existingLuisApp = require ( './../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json' )
356+ before ( function ( ) {
357+ nock ( 'https://westus.api.cognitive.microsoft.com' )
358+ . get ( uri => uri . includes ( 'apps' ) )
359+ . reply ( 200 , [ {
360+ name : 'test(development)-sandwich.en-us.lu' ,
361+ id : 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5' ,
362+ endpoints : {
363+ "v0.1" : {
364+ versionId : '0.1'
365+ }
366+ }
367+ } ] )
368+
369+ nock ( 'https://westus.api.cognitive.microsoft.com' )
370+ . get ( uri => uri . includes ( 'apps' ) )
371+ . reply ( 200 , {
372+ name : 'test(development)-sandwich.en-us.lu' ,
373+ id : 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5' ,
374+ activeVersion : '0.1'
375+ } )
376+
377+ nock ( 'https://westus.api.cognitive.microsoft.com' )
378+ . get ( uri => uri . includes ( 'export' ) )
379+ . reply ( 200 , existingLuisApp )
380+
381+ nock ( 'https://westus.api.cognitive.microsoft.com' )
382+ . post ( uri => uri . includes ( 'train' ) )
383+ . reply ( 202 , {
384+ statusId : 2 ,
385+ status : 'UpToDate'
386+ } )
387+
388+ nock ( 'https://westus.api.cognitive.microsoft.com' )
389+ . get ( uri => uri . includes ( 'train' ) )
390+ . reply ( 200 , [ {
391+ modelId : '99999' ,
392+ details : {
393+ statusId : 0 ,
394+ status : 'Success' ,
395+ exampleCount : 0
396+ }
397+ } ] )
398+
399+ nock ( 'https://westus.api.cognitive.microsoft.com' )
400+ . post ( uri => uri . includes ( 'publish' ) )
401+ . reply ( 201 , {
402+ versionId : '0.1' ,
403+ isStaging : false
404+ } )
405+ } )
406+
407+ test
408+ . stdout ( )
409+ . command ( [ 'luis:build' , '--in' , './test/fixtures/testcases/lubuild/sandwich/lufiles/sandwich.en-us.lu' , '--authoringKey' , uuidv1 ( ) , '--botName' , 'test' , '--log' , '--suffix' , 'development' ] )
410+ . it ( 'should update a luis application when only publishing mode changes(directVersionPublish mode to Production slot)' , ctx => {
411+ expect ( ctx . stdout ) . to . contain ( 'Handling applications...' )
412+ expect ( ctx . stdout ) . to . contain ( 'training version=0.1' )
413+ expect ( ctx . stdout ) . to . contain ( 'waiting for training for version=0.1' )
414+ expect ( ctx . stdout ) . to . contain ( 'publishing version=0.1' )
415+ expect ( ctx . stdout ) . to . contain ( 'publishing finished for Production slot' )
416+ } )
417+ } )
418+
419+ describe ( 'luis:build update application succeed when only publishing mode changes(Production slot to Staging slot)' , ( ) => {
420+ const existingLuisApp = require ( './../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json' )
421+ before ( function ( ) {
422+ nock ( 'https://westus.api.cognitive.microsoft.com' )
423+ . get ( uri => uri . includes ( 'apps' ) )
424+ . reply ( 200 , [ {
425+ name : 'test(development)-sandwich.en-us.lu' ,
426+ id : 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5' ,
427+ endpoints : {
428+ PRODUCTION : {
429+ versionId : '0.1'
430+ }
431+ }
432+ } ] )
433+
434+ nock ( 'https://westus.api.cognitive.microsoft.com' )
435+ . get ( uri => uri . includes ( 'apps' ) )
436+ . reply ( 200 , {
437+ name : 'test(development)-sandwich.en-us.lu' ,
438+ id : 'f8c64e2a-8635-3a09-8f78-39d7adc76ec5' ,
439+ activeVersion : '0.1'
440+ } )
441+
442+ nock ( 'https://westus.api.cognitive.microsoft.com' )
443+ . get ( uri => uri . includes ( 'export' ) )
444+ . reply ( 200 , existingLuisApp )
445+
446+ nock ( 'https://westus.api.cognitive.microsoft.com' )
447+ . post ( uri => uri . includes ( 'train' ) )
448+ . reply ( 202 , {
449+ statusId : 2 ,
450+ status : 'UpToDate'
451+ } )
452+
453+ nock ( 'https://westus.api.cognitive.microsoft.com' )
454+ . get ( uri => uri . includes ( 'train' ) )
455+ . reply ( 200 , [ {
456+ modelId : '99999' ,
457+ details : {
458+ statusId : 0 ,
459+ status : 'Success' ,
460+ exampleCount : 0
461+ }
462+ } ] )
463+
464+ nock ( 'https://westus.api.cognitive.microsoft.com' )
465+ . post ( uri => uri . includes ( 'publish' ) )
466+ . reply ( 201 , {
467+ versionId : '0.1' ,
468+ isStaging : false
469+ } )
470+ } )
471+
472+ test
473+ . stdout ( )
474+ . command ( [ 'luis:build' , '--in' , './test/fixtures/testcases/lubuild/sandwich/lufiles/sandwich.en-us.lu' , '--authoringKey' , uuidv1 ( ) , '--botName' , 'test' , '--log' , '--suffix' , 'development' , '--isStaging' ] )
475+ . it ( 'should update a luis application when only publishing mode changes(Production slot to Staging slot)' , ctx => {
476+ expect ( ctx . stdout ) . to . contain ( 'Handling applications...' )
477+ expect ( ctx . stdout ) . to . contain ( 'training version=0.1' )
478+ expect ( ctx . stdout ) . to . contain ( 'waiting for training for version=0.1' )
479+ expect ( ctx . stdout ) . to . contain ( 'publishing version=0.1' )
480+ expect ( ctx . stdout ) . to . contain ( 'publishing finished for Staging slot' )
481+ } )
482+ } )
483+
289484describe ( 'luis:build not update application if no changes' , ( ) => {
290485 const existingLuisApp = require ( './../../fixtures/testcases/lubuild/sandwich/luis/test(development)-sandwich.en-us.lu.json' )
291486 before ( function ( ) {
0 commit comments