@@ -490,23 +490,16 @@ suite('DotnetCoreAcquisitionExtension End to End', function ()
490490 }
491491 } ) . timeout ( standardTimeoutTime ) ;
492492
493- test ( 'Install SDK Globally E2E (Requires Admin)' , async ( ) =>
493+ async function runGlobalSdkInstallTest ( version : string )
494494 {
495- // We only test if the process is running under ADMIN because non-admin requires user-intervention.
496- const sdkVersion = '7.0.103' ;
497- const context : IDotnetAcquireContext = { version : sdkVersion , requestingExtensionId : 'sample-extension' , installType : 'global' } ;
495+ const context : IDotnetAcquireContext = { version, requestingExtensionId : 'sample-extension' , installType : 'global' } ;
498496 if ( await new FileUtilities ( ) . isElevated ( getMockAcquisitionWorkerContext ( context ) , getMockUtilityContext ( ) ) )
499497 {
500498 const originalPath = process . env . PATH ;
501-
502- // We cannot use the describe pattern to restore the environment variables using vscode's extension testing infrastructure.
503- // So we must set and unset it ourselves, which isn't ideal as this variable could remain.
504- let result : IDotnetAcquireResult ;
499+ let result : IDotnetAcquireResult | undefined ;
505500 let error : any ;
506- let pathAfterInstall ;
501+ let pathAfterInstall : string | undefined ;
507502
508- // We cannot test much as we don't want to leave global installs on dev boxes. But we do want to make sure the e-2-e goes through the right path. Vendors can test the rest.
509- // So we have this environment variable that tells us to stop before running any real install.
510503 process . env . VSCODE_DOTNET_GLOBAL_INSTALL_FAKE_PATH = 'true' ;
511504 try
512505 {
@@ -521,25 +514,43 @@ suite('DotnetCoreAcquisitionExtension End to End', function ()
521514 pathAfterInstall = process . env . PATH ;
522515 process . env . VSCODE_DOTNET_GLOBAL_INSTALL_FAKE_PATH = undefined ;
523516 process . env . PATH = originalPath ;
517+ }
524518
525- if ( error )
526- {
527- throw ( new Error ( `The test failed to run the acquire command successfully. Error: ${ error } ` ) ) ;
528- }
519+ if ( error )
520+ {
521+ throw new Error ( `The test failed to run the acquire command successfully for version ${ version } . Error: ${ error } ` ) ;
529522 }
530523
531- assert . exists ( result ! , ' The global acquisition command did not provide a result?' ) ;
524+ assert . exists ( result , ` The global acquisition command did not provide a result for version ${ version } ` ) ;
532525 assert . exists ( result ! . dotnetPath ) ;
533526 assert . equal ( result ! . dotnetPath , 'fake-sdk' ) ;
534527 assert . exists ( pathAfterInstall , 'The environment variable PATH for DOTNET was not found?' ) ;
535- assert . include ( pathAfterInstall , result ! . dotnetPath , 'Is the PATH correctly set by the global installer?' ) ;
528+ assert . include ( pathAfterInstall ! , result ! . dotnetPath , 'Is the PATH correctly set by the global installer?' ) ;
536529 }
537530 else
538531 {
539- // We could run the installer without privilege but it would require human interaction to use the UAC
540- // And we wouldn't be able to kill the process so the test would leave a lot of hanging processes on the machine
541532 warn ( 'The Global SDK E2E Install test cannot run as the machine is unprivileged.' ) ;
542533 }
534+ }
535+
536+ test ( 'Install SDK Globally E2E (Requires Admin)' , async ( ) =>
537+ {
538+ await runGlobalSdkInstallTest ( '7.0.103' ) ;
539+ } ) . timeout ( standardTimeoutTime * 1000 ) ;
540+
541+ test ( 'Install SDK Globally with major version format' , async ( ) =>
542+ {
543+ await runGlobalSdkInstallTest ( '9' ) ;
544+ } ) . timeout ( standardTimeoutTime * 1000 ) ;
545+
546+ test ( 'Install SDK Globally with major minor format' , async ( ) =>
547+ {
548+ await runGlobalSdkInstallTest ( '10.0' ) ;
549+ } ) . timeout ( standardTimeoutTime * 1000 ) ;
550+
551+ test ( 'Install SDK Globally with feature band format' , async ( ) =>
552+ {
553+ await runGlobalSdkInstallTest ( '10.0.1xx' ) ;
543554 } ) . timeout ( standardTimeoutTime * 1000 ) ;
544555
545556 test ( 'Telemetry Sent During Install and Uninstall' , async ( ) =>
@@ -778,7 +789,7 @@ Paths: 'acquire returned: ${resultForAcquiringPathSettingRuntime.dotnetPath} whi
778789 assert . exists ( result ) ;
779790 assert . exists ( result ! . dotnetPath ) ;
780791 assert . isTrue ( fs . existsSync ( result ! . dotnetPath ! ) ) ;
781- await promisify ( rimraf ) ( result ! . dotnetPath ! ) ;
792+ await fs . promises . rm ( result ! . dotnetPath ! , { force : true } ) ;
782793 }
783794
784795 test ( 'Install Runtime Status Command' , async ( ) =>
0 commit comments