Add tests for docker image
Adds Pester tests to the docker image created for isolated runtime test containers.
This commit is contained in:
Родитель
5c59e3e2b3
Коммит
e2224a6df1
|
@ -25,4 +25,7 @@ ADD ["Instances/", "C:/ProgramData/Microsoft/VisualStudio/Packages/_Instances/"]
|
|||
RUN $ErrorActionPreference = 'Stop' ; \
|
||||
New-Item -Path C:\VS\Community, C:\VS\Enterprise, C:\VS\Professional, C:\BuildTools -Type Directory | Out-Null
|
||||
|
||||
# Copy tests
|
||||
ADD ["Tests", "C:/Tests"]
|
||||
|
||||
ENTRYPOINT ["powershell.exe", "-ExecutionPolicy", "Unrestricted"]
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.
|
||||
|
||||
Describe 'Get-VSSetupInstance' {
|
||||
$en = New-Object System.Globalization.CultureInfo 'en-US'
|
||||
$de = New-Object System.Globalization.CultureInfo 'de-DE'
|
||||
|
||||
Context 'Launchable instances' {
|
||||
[System.Globalization.CultureInfo]::CurrentUICulture = $en
|
||||
$instances = Get-VSSetupInstance
|
||||
|
||||
It 'Returns 3 instances' {
|
||||
$instances.Count | Should Be 3
|
||||
}
|
||||
}
|
||||
|
||||
Context 'All instances' {
|
||||
[System.Globalization.CultureInfo]::CurrentUICulture = $en
|
||||
$instances = Get-VSSetupInstance -All
|
||||
|
||||
It 'Returns 4 instances' {
|
||||
$instances.Count | Should Be 4
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Specified path' {
|
||||
It 'Accepts pipeline input' {
|
||||
[System.Globalization.CultureInfo]::CurrentUICulture = $en
|
||||
$instance = Get-Item C:\VS\Community | Get-VSSetupInstance
|
||||
|
||||
$instance.InstanceId | Should Be 1
|
||||
}
|
||||
It 'Returns Community properties' {
|
||||
[System.Globalization.CultureInfo]::CurrentUICulture = $en
|
||||
$instance = Get-VSSetupInstance 'C:\VS\Community'
|
||||
|
||||
$instance.InstanceId | Should Be 1
|
||||
$instance.InstallationName | Should Be 'VisualStudio/public.d15rel/15.0.26116.0'
|
||||
$instance.InstallationPath | Should Be 'C:\VS\Community'
|
||||
$instance.InstallationVersion | Should Be '15.0.26116.0'
|
||||
$instance.DisplayName | Should Be 'Visual Studio Community 2017'
|
||||
$instance.Description | Should Match '^Free'
|
||||
$instance.Product.Id | Should Be 'Microsoft.VisualStudio.Product.Community'
|
||||
$instance.Product.Version | Should Be '15.0.26116.0'
|
||||
$instance.Packages.Count | Should Be 4
|
||||
}
|
||||
|
||||
It 'Returns Community properties (de-DE)' {
|
||||
[System.Globalization.CultureInfo]::CurrentUICulture = $de
|
||||
$instance = Get-VSSetupInstance 'C:\VS\Community'
|
||||
|
||||
$instance.InstanceId | Should Be 1
|
||||
$instance.DisplayName | Should Be 'Visual Studio Community 2017'
|
||||
$instance.Description | Should Match '^Kostenlose'
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
# Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.
|
||||
|
||||
Describe 'Select-VSSetupInstance' {
|
||||
Context 'Defaults to VS' {
|
||||
$instances = Get-VSSetupInstance | Select-VSSetupInstance
|
||||
|
||||
It 'Returns 2 instances' {
|
||||
$instances.Count | Should Be 2
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Returns latest launchable VS' {
|
||||
$instances = Get-VSSetupInstance | Select-VSSetupInstance -Latest
|
||||
|
||||
It 'Returns 1 instance' {
|
||||
$instances.Count | Should Be 1
|
||||
}
|
||||
|
||||
It 'Returns Enterprise instance' {
|
||||
$instances[0].InstanceId | Should Be 2
|
||||
$instances[0].Product.Id | Should Be 'Microsoft.VisualStudio.Product.Enterprise'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Returns latest VS' {
|
||||
$instances = Get-VSSetupInstance -All | Select-VSSetupInstance -Latest
|
||||
|
||||
It 'Returns 1 instance' {
|
||||
$instances.Count | Should Be 1
|
||||
}
|
||||
|
||||
It 'Returns Professional instance' {
|
||||
$instances[0].InstanceId | Should Be 3
|
||||
$instances[0].Product.Id | Should Be 'Microsoft.VisualStudio.Product.Professional'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Supports other products' {
|
||||
$instances = Get-VSSetupInstance | Select-VSSetupInstance -Product 'Microsoft.VisualStudio.Product.BuildTools'
|
||||
|
||||
It 'Returns 1 instance' {
|
||||
$instances.Count | Should Be 1
|
||||
}
|
||||
|
||||
It 'Returns Build Tools instance' {
|
||||
$instances[0].InstanceId | Should Be 4
|
||||
$instances[0].Product.Id | Should Be 'Microsoft.VisualStudio.Product.BuildTools'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Queries specified workloads' {
|
||||
$instances = Get-VSSetupInstance | Select-VSSetupInstance -Require 'Microsoft.VisualStudio.Workload.ManagedDesktop'
|
||||
|
||||
It 'Returns 2 insances' {
|
||||
$instances.Count | Should Be 2
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@ set root=%projectDir:~0,-1%
|
|||
|
||||
@echo on
|
||||
docker build --network "%network%" --tag %name% "%root%"
|
||||
@if errorlevel 1 exit /b %ERRORLEVEL%
|
||||
|
||||
@echo off
|
||||
echo.
|
||||
|
|
|
@ -39,6 +39,7 @@ set outputPath=%solutionDir%src\VSSetup.PowerShell\bin\%configuration%
|
|||
|
||||
@echo on
|
||||
docker run -it -v "%outputPath%:C:\Users\ContainerAdministrator\Documents\WindowsPowerShell\Modules\VSSetup" %params% %name% %args%
|
||||
@if errorlevel 1 exit /b %ERRORLEVEL%
|
||||
|
||||
@echo off
|
||||
echo.
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
@echo off
|
||||
|
||||
REM Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
REM Licensed under the MIT license. See LICENSE.txt in the project root for license information.
|
||||
|
||||
setlocal
|
||||
|
||||
%~dp0run.cmd %* -- -c Invoke-Pester C:\Tests -EnableExit
|
Загрузка…
Ссылка в новой задаче