Added automated tests for Kvm-Install

This commit is contained in:
anurse 2014-12-16 17:59:06 -08:00
Родитель 7ad2fa5419
Коммит c266bad760
11 изменённых файлов: 600 добавлений и 21 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -1,3 +1,7 @@
# Pester PowerShell Unit Test Framework is fetched from Git when needed
.pester/
.testwork/
[Oo]bj/
[Bb]in/
TestResults/

Просмотреть файл

@ -7,6 +7,7 @@ param(
[alias("p")][switch] $Persistent = $false,
[alias("f")][switch] $Force = $false,
[alias("r")][string] $Runtime,
[alias("arch")][string] $Architecture,
[switch] $X86 = $false,
[switch] $Amd64 = $false,
#deprecated
@ -20,16 +21,25 @@ param(
[string] $Alias = $null,
[switch] $NoNative = $false,
[parameter(Position=1, ValueFromRemainingArguments=$true)]
[string[]]$Args=@()
[string[]]$Args=@(),
[switch] $Quiet,
[string] $OutputVariable,
[switch] $AssumeElevated
)
$selectedArch=$null;
$defaultArch="x86"
$selectedRuntime=$null
$defaultRuntime="CLR"
$userKrePath = $env:USERPROFILE + "\.kre"
# Get or calculate userKrePath
$userKrePath = $env:USER_KRE_PATH
if(!$userKrePath) { $userKrePath = $env:USERPROFILE + "\.kre" }
$userKrePackages = $userKrePath + "\packages"
$globalKrePath = $env:ProgramFiles + "\KRE"
# Get or calculate globalKrePath
$globalKrePath = $env:GLOBAL_KRE_PATH
if(!$globalKrePath) { $globalKrePath = $env:ProgramFiles + "\KRE" }
$globalKrePackages = $globalKrePath + "\packages"
$feed = $env:KRE_FEED
@ -45,6 +55,8 @@ if (!$feed)
$feed = "https://www.myget.org/F/aspnetvnext/api/v2";
}
$feed = $feed.TrimEnd("/")
$scriptPath = $myInvocation.MyCommand.Definition
function Kvm-Help {
@ -185,6 +197,7 @@ param(
$wc = New-Object System.Net.WebClient
Add-Proxy-If-Specified($wc)
Write-Debug "DownloadString: $url"
[xml]$xml = $wc.DownloadString($url)
$version = Select-Xml "//d:Version" -Namespace @{d='http://schemas.microsoft.com/ado/2007/08/dataservices'} $xml
@ -231,6 +244,7 @@ param(
$wc = New-Object System.Net.WebClient
Add-Proxy-If-Specified($wc)
Write-Debug "DownloadFile: $url, $tempKreFile"
$wc.DownloadFile($url, $tempKreFile)
Do-Kvm-Unpack $tempKreFile $kreTempDownload
@ -686,6 +700,10 @@ SET "PATH=$newPath"
}
function Needs-Elevation() {
if($AssumeElevated) {
return $false
}
$user = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()
$elevated = $user.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
return -NOT $elevated
@ -725,33 +743,52 @@ function Validate-And-Santitize-Switches()
Set-Variable -Name "selectedRuntime" -Value "svrc50" -Scope Script
}
if ($X64) {
Console-Write "Warning: -x64 is deprecated, use -amd64 for new packages."
Set-Variable -Name "selectedArch" -Value "x64" -Scope Script
} elseif ($Amd64) {
Set-Variable -Name "selectedArch" -Value "amd64" -Scope Script
} elseif ($X86) {
Set-Variable -Name "selectedArch" -Value "x86" -Scope Script
if($Architecture) {
$validArchitectures = "amd64", "x86"
$match = $validArchitectures | ? { $_ -like $Architecture } | Select -First 1
if(!$match) {throw "'$architecture' is not a valid architecture"}
Set-Variable -Name "selectedArch" -Value $match -Scope Script
}
else {
if ($X64) {
Console-Write "Warning: -x64 is deprecated, use -amd64 for new packages."
Set-Variable -Name "selectedArch" -Value "x64" -Scope Script
} elseif ($Amd64) {
Set-Variable -Name "selectedArch" -Value "amd64" -Scope Script
} elseif ($X86) {
Set-Variable -Name "selectedArch" -Value "x86" -Scope Script
}
}
Write-Debug "Runtime=$selectedRuntime"
Write-Debug "Arch=$selectedArch"
}
$script:capturedOut = @()
function Console-Write() {
param(
[Parameter(ValueFromPipeline=$true)]
[string] $message
)
if ($useHostOutputMethods) {
try {
Write-Host $message
}
catch {
$script:useHostOutputMethods = $false
Console-Write $message
}
if($OutputVariable) {
# Update the capture output
$script:capturedOut += @($message)
}
if(!$Quiet) {
if ($useHostOutputMethods) {
try {
Write-Host $message
}
catch {
$script:useHostOutputMethods = $false
Console-Write $message
}
}
else {
[Console]::WriteLine($message)
}
}
else {
[Console]::WriteLine($message)
}
}
function Console-Write-Error() {
@ -821,4 +858,9 @@ if ($Wait) {
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown,AllowCtrlC")
}
# If the user specified an output variable, push the value up to the parent scope
if($OutputVariable) {
Set-Variable $OutputVariable $script:capturedOut -Scope 1
}
exit $exitCode

Просмотреть файл

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="__ToolsVersion__" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>0ef87869-3442-40aa-a0e6-089cd385f7d0</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
<ProjectExtensions>
<VisualStudio>
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
</VisualStudio>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22410.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HelloK", "HelloK.kproj", "{0EF87869-3442-40AA-A0E6-089CD385F7D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0EF87869-3442-40AA-A0E6-089CD385F7D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EF87869-3442-40AA-A0E6-089CD385F7D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EF87869-3442-40AA-A0E6-089CD385F7D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EF87869-3442-40AA-A0E6-089CD385F7D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

102
test/apps/HelloK/Program.cs Normal file
Просмотреть файл

@ -0,0 +1,102 @@
using System;
using System.Diagnostics;
using Microsoft.Framework.Runtime;
using Microsoft.Framework.Runtime.Common.CommandLine;
namespace HelloK {
public class Program {
private readonly IApplicationEnvironment _env;
public Program(IApplicationEnvironment env) {
_env = env;
}
private string GetUnameValue(string arg) {
var psi = new ProcessStartInfo("uname", "-" + arg);
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
var p = Process.Start(psi);
var ret = p.StandardOutput.ReadToEnd().Trim();
p.WaitForExit();
return ret;
}
private string GetSwVersValue(string arg) {
var psi = new ProcessStartInfo("sw_vers", "-" + arg);
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
var p = Process.Start(psi);
var ret = p.StandardOutput.ReadToEnd().Trim();
p.WaitForExit();
return ret;
}
#if !ASPNETCORE50
private string GetPlatform() {
if(Environment.OSVersion.Platform == PlatformID.Unix) {
var kern = GetUnameValue("s");
var kernVer = GetUnameValue("r");
if(string.Equals(kern, "Darwin", StringComparison.OrdinalIgnoreCase)) {
var name = GetSwVersValue("productName");
var ver = GetSwVersValue("productVersion");
var build = GetSwVersValue("buildVersion");
return name + " " + ver + " Build " + build + " (" + kern + " " + kernVer + ")";
} else {
return kern + " " + kernVer;
}
} else {
return Environment.OSVersion.VersionString;
}
}
#endif
public int Main(string[] args) {
var art =
"\x1b[33m ___ _______ \x1b[34m _ ____________" + Environment.NewLine +
"\x1b[33m / _ | / __/ _ \\ \x1b[34m / |/ / __/_ __/" + Environment.NewLine +
"\x1b[33m / __ |_\\ \\/ ___/ \x1b[34m/ / _/ / / " + Environment.NewLine +
"\x1b[33m/_/ |_/___/_/ \x1b[37m(_)\x1b[34m_/|_/___/ /_/ \x1b[39m";
AnsiConsole.Output.WriteLine(art);
AnsiConsole.Output.WriteLine("K is sane!");
AnsiConsole.Output.WriteLine("\x1b[30mRuntime Framework: \x1b[39m " + _env.RuntimeFramework.ToString());
#if ASPNETCORE50
AnsiConsole.Output.WriteLine("\x1b[30mRuntime: \x1b[39m Microsoft CoreCLR");
#else
// Platform detection
var platform = GetPlatform();
AnsiConsole.Output.WriteLine("\x1b[30mRuntime: \x1b[39m " + (Type.GetType("Mono.Runtime") != null ? "Mono CLR" : "Microsoft CLR"));
AnsiConsole.Output.WriteLine("\x1b[30mRuntime Version: \x1b[39m " + Environment.Version.ToString());
AnsiConsole.Output.WriteLine("\x1b[30mOS: \x1b[39m " + platform);
AnsiConsole.Output.WriteLine("\x1b[30mMachine Name: \x1b[39m " + Environment.MachineName ?? "<null>");
AnsiConsole.Output.WriteLine("\x1b[30mUser Name: \x1b[39m " + Environment.UserName ?? "<null>");
AnsiConsole.Output.WriteLine("\x1b[30mSystem Directory: \x1b[39m " + Environment.SystemDirectory ?? "<null>");
AnsiConsole.Output.WriteLine("\x1b[30mCurrent Directory: \x1b[39m " + Environment.CurrentDirectory ?? "<null>");
#endif
AnsiConsole.Output.WriteLine("");
AnsiConsole.Output.WriteLine(
"\x1b[1m" +
"\x1b[30mA" +
"\x1b[31mN" +
"\x1b[32mS" +
"\x1b[33mI" + " " +
"\x1b[34mR" +
"\x1b[35ma" +
"\x1b[36mi" +
"\x1b[37mn" +
"\x1b[38mb" +
"\x1b[22m" +
"\x1b[30mo" +
"\x1b[32mw" +
"\x1b[33m!" +
"\x1b[34m!" +
"\x1b[35m!" +
"\x1b[36m!" +
"\x1b[37m!" +
"\x1b[38m!" +
"\x1b[39m");
return 0;
}
}
}

Просмотреть файл

@ -0,0 +1,22 @@
{
"version": "0.0.1-*",
"description": "Quick app to exercise a few K things",
"dependencies": {
"Microsoft.Framework.Runtime.Interfaces": { "version": "1.0.0-*", "type": "build" },
"Microsoft.Framework.CommandLineUtils": { "version": "1.0.0-*", "type": "build" }
},
"commands": {
"run": "run"
},
"frameworks": {
"aspnet50": { },
"aspnetcore50": {
"dependencies": {
"System.Console": "4.0.0-*",
"System.Collections": "4.0.10-*",
"System.Diagnostics.Process": "4.0.0-*",
"System.Linq": "4.0.0-*"
}
}
}
}

2
test/apps/README.md Normal file
Просмотреть файл

@ -0,0 +1,2 @@
# Test Apps
Sample K apps for testing KVM installations.

48
test/ps1/Run-Tests.ps1 Normal file
Просмотреть файл

@ -0,0 +1,48 @@
#Requires -Version 3
<#
.SYNOPSIS
Runs the tests for kvm
.PARAMETER PesterPath
The path to the root of the Pester (https://github.com/pester/Pester) module
.PARAMETER PesterRef
A git ref (branch, tag or commit id) to check out in the pester repo
.PARAMETER PesterRepo
The repository to clone Pester from (defaults to https://github.com/pester/Pester)
#>
param(
[string]$PesterPath = $null,
[string]$PesterRef = "3.2.0",
[string]$PesterRepo = "https://github.com/pester/Pester",
[string]$TestsPath = $null,
[string]$KvmPath = $null,
[string]$TestName = $null,
[string]$TestWorkingDir = $null,
[string]$TestAppsDir = $null,
[Alias("Tags")][string]$Tag = $null,
[switch]$Strict,
[switch]$Quiet,
[switch]$Fast,
[switch]$Debug)
. "$PSScriptRoot\_Common.ps1"
Write-Banner "Starting child shell"
# Crappy that we have to duplicate things here...
$childArgs = @()
$PSBoundParameters.Keys | ForEach-Object {
$key = $_
$value = $PSBoundParameters[$key]
if($value -is [switch]) {
if($value.IsPresent) {
$childArgs += @("-$key")
}
} else {
$childArgs += @("-$key",$value)
}
}
& powershell -NoProfile -NoLogo -File "$PSScriptRoot\_Execute-Tests.ps1" @childArgs -RunningInNewPowershell

56
test/ps1/_Common.ps1 Normal file
Просмотреть файл

@ -0,0 +1,56 @@
function Write-Banner {
param($Message)
Write-Host -ForegroundColor Green "===== $Message ====="
}
filter Write-CommandOutput {
param($Prefix)
Write-Host -ForegroundColor Magenta -NoNewLine "$($Prefix): "
Write-Host $_
}
$KreVersionRegex = [regex]"(?<ver>\d+\.\d+.\d+)(\-(?<tag>.+))?"
function Parse-KreVersion {
param($Version)
$m = $KreVersionRegex.Match($Version)
if(!$m.Success) {
throw "Invalid Version: $Version"
}
New-Object PSObject -Prop @{
"Version" = (New-Object Version $m.Groups["ver"].Value)
"Tag" = $m.Groups["tag"].Value
}
}
function GetKresOnPath {
param($kreHome)
if(!$kreHome) {
$kreHome = $env:USER_KRE_PATH
}
@(($env:PATH).Split(";") | Where { $_.StartsWith("$kreHome\packages") })
}
function GetActiveKrePath {
param($kreHome)
GetKresOnPath $kreHome | Select -First 1
}
function GetActiveKreName {
param($kreHome)
if(!$kreHome) {
$kreHome = $env:USER_KRE_PATH
}
$activeKre = GetActiveKrePath $kreHome
if($activeKre) {
$activeKre.Replace("$kreHome\packages\", "").Replace("\bin", "")
}
}
function GetKreName {
param($clr, $arch, $ver = $testVer)
"KRE-$clr-$arch.$testVer"
}

129
test/ps1/_Execute-Tests.ps1 Normal file
Просмотреть файл

@ -0,0 +1,129 @@
#Requires -Version 3
<#
.SYNOPSIS
Runs the tests for kvm
.PARAMETER PesterPath
The path to the root of the Pester (https://github.com/pester/Pester) module
.PARAMETER PesterRef
A git ref (branch, tag or commit id) to check out in the pester repo
.PARAMETER PesterRepo
The repository to clone Pester from (defaults to https://github.com/pester/Pester)
#>
param(
[string]$PesterPath = $null,
[string]$PesterRef = "3.2.0",
[string]$PesterRepo = "https://github.com/pester/Pester",
[string]$TestsPath = $null,
[string]$KvmPath = $null,
[string]$TestName = $null,
[string]$TestWorkingDir = $null,
[string]$TestAppsDir = $null,
[Alias("Tags")][string]$Tag = $null,
[switch]$Strict,
[switch]$Quiet,
[switch]$Fast,
[switch]$Debug,
[switch]$RunningInNewPowershell)
if(!$RunningInNewPowershell) {
throw "Don't use this script to run the tests! Use Run-Tests.ps1, it sets up a new powershell instance in which to run the tests!"
}
. "$PSScriptRoot\_Common.ps1"
Write-Banner "In child shell"
# Check for commands
if(!(Get-Command git -ErrorAction SilentlyContinue)) { throw "Need git to run tests!" }
# Set defaults
if(!$PesterPath) { $PesterPath = Join-Path $PSScriptRoot ".pester" }
if(!$TestsPath) { $TestsPath = Join-Path $PSScriptRoot "tests" }
if(!$KvmPath) { $KvmPath = Convert-Path (Join-Path $PSScriptRoot "../../src/kvm.ps1") }
if(!$TestWorkingDir) { $TestWorkingDir = Join-Path $PSScriptRoot ".testwork" }
if(!$TestAppsDir) { $TestAppsDir = Convert-Path (Join-Path $PSScriptRoot "../apps") }
# Check that Pester is present
Write-Banner "Ensuring Pester is at $PesterRef"
if(!(Test-Path $PesterPath)) {
git clone $PesterRepo $PesterPath 2>&1 | Write-CommandOutput "git"
}
# Get the right tag checked out
pushd $PesterPath
git checkout $PesterRef 2>&1 | Write-CommandOutput "git"
popd
# Set up context
$kvm = $KvmPath
Write-Host "Using kvm: $kvm"
# Create test area
if(Test-Path "$TestWorkingDir\kre") {
Write-Banner "Wiping old test working area"
del -rec -for "$TestWorkingDir\kre"
}
else {
mkdir $TestWorkingDir | Out-Null
}
# Import the module and set up test environment
Import-Module "$PesterPath\Pester.psm1"
if($Debug) {
$oldDebugPreference = $DebugPreference
$DebugPreference = "Continue"
}
# Unset KRE_HOME for the test
$oldKreHome = $env:KRE_HOME
del env:\KRE_HOME
# Unset KRE_TRACE for the test
del env:\KRE_TRACE
$env:USER_KRE_PATH = "$TestWorkingDir\kre\user"
mkdir $env:USER_KRE_PATH | Out-Null
$env:GLOBAL_KRE_PATH = "$TestWorkingDir\kre\global"
mkdir $env:GLOBAL_KRE_PATH | Out-Null
$env:KRE_NUGET_API_URL = "https://www.myget.org/F/aspnetmaster/api/v2"
$TestKind = "all"
if($Fast) {
$TestKind = "fast"
}
$kvmout = $null
function runkvm {
$kvmout = $null
& $kvm -AssumeElevated -OutputVariable kvmout -Quiet @args
$LASTEXITCODE | Should Be 0
if($Debug) {
$kvmout | Write-CommandOutput kvm
}
# Push the value up a scope
Set-Variable kvmout $kvmout -Scope 1
}
Write-Banner "Fetching test prerequisites"
$specificNupkgUrl = "https://www.myget.org/F/aspnetmaster/api/v2/package/KRE-CLR-x86/1.0.0-alpha4"
$specificNupkgName = "KRE-CLR-x86.1.0.0-alpha4.nupkg"
$specificNuPkgFxName = "Asp.Net,Version=v5.0"
$downloadDir = Join-Path $TestWorkingDir "downloads"
if(!(Test-Path $downloadDir)) { mkdir $downloadDir | Out-Null }
$specificNupkgPath = Join-Path $downloadDir $specificNupkgName
if(!(Test-Path $specificNupkgPath)) {
Invoke-WebRequest $specificNupkgUrl -OutFile $specificNupkgPath
}
Write-Banner "Running $TestKind Pester Tests in $TestsPath"
Invoke-Pester -Path $TestsPath -TestName $TestName -Tag $Tag -Strict:$Strict -Quiet:$Quiet

Просмотреть файл

@ -0,0 +1,128 @@
$testVer = "1.0.0-beta1"
$archs=@("x86", "amd64") # List of architectures to test
$clrs=@("CLR", "CoreCLR") # List of runtimes to test
$crossgenned=@("mscorlib") # List of assemblies to check native images for on CoreCLR
# We can't put Tags on "Context" in Pester, only "Describe" so use this $Fast variable to skip other archs/clrs
if($Fast) {
$archs=@("x86")
$clrs=@("CLR")
}
function DefineInstallTests($clr, $arch, [switch]$global) {
$kreHome = $env:USER_KRE_PATH
$contextName = "for user"
$alias = "install_test_$arch_$clr"
if($global) {
$contextName = "globally"
$alias = "global_$alias"
$kreHome = $env:GLOBAL_KRE_PATH
}
if($clr -eq "CoreCLR") {
$fxName = "Asp.NetCore,Version=v5.0"
} else {
$fxName = "Asp.Net,Version=v5.0"
}
$kreName = GetKreName $clr $arch
$kreRoot = "$kreHome\packages\$kreName"
Context "When installing $clr on $arch $contextName" {
It "downloads and unpacks a KRE" {
if($global) {
runkvm install $testVer -arch $arch -r $clr -a $alias -global
} else {
runkvm install $testVer -arch $arch -r $clr -a $alias
}
}
It "installs the KRE into the user directory" {
$kreRoot | Should Exist
}
if($clr -eq "CoreCLR") {
It "crossgenned native assemblies" {
$crossgenned | ForEach-Object { "$kreRoot\bin\$_.ni.dll" } | Should Exist
}
}
It "can restore packages for the HelloK sample" {
pushd "$TestAppsDir\HelloK"
try {
& "$kreRoot\bin\kpm.cmd" restore
} finally {
popd
}
}
It "can run the HelloK sample" {
pushd "$TestAppsDir\HelloK"
try {
$output = & "$kreRoot\bin\k.cmd" run
$LASTEXITCODE | Should Be 0
$fullOutput = [String]::Join("`r`n", $output)
$fullOutput | Should Match "K is sane!"
$fullOutput | Should Match "Runtime Framework:\s+$fxName"
} finally {
popd
}
}
It "assigned the requested alias" {
"$env:USER_KRE_PATH\alias\$alias.txt" | Should Exist
"$env:USER_KRE_PATH\alias\$alias.txt" | Should ContainExactly $kreName
}
It "uses the new KRE" {
GetActiveKreName $kreHome | Should Be "$kreName"
}
}
}
Describe "Kvm-Install" {
$archs | ForEach-Object {
$arch = $_
$clrs | ForEach-Object {
$clr = $_
DefineInstallTests $clr $arch
DefineInstallTests $clr $arch -global
}
}
Context "When installing latest" {
$previous = @(dir "$env:USER_KRE_PATH\packages" | select -ExpandProperty Name)
It "downloads a KRE" {
runkvm install latest -arch x86 -r CLR
}
# TODO: Check that it actually installed the latest?
}
Context "When installing an already-installed KRE" {
# Clear active KRE
runkvm use none
$kreName = GetKreName $clrs[0] $archs[0]
$krePath = "$env:USER_KRE_PATH\packages\$kreName"
It "ensures the KRE is installed" {
runkvm install $testVer -arch $archs[0] -r $clrs[0]
$kvmout[0] | Should Match "$kreName already installed"
$krePath | Should Exist
}
}
Context "When installing a specific nupkg" {
$name = [IO.Path]::GetFileNameWithoutExtension($specificNupkgName)
$kreRoot = "$env:USER_KRE_PATH\packages\$name"
It "unpacks the KRE" {
runkvm install $specificNupkgPath
}
It "installs the KRE into the user directory" {
$kreRoot | Should Exist
}
It "did not assign an alias" {
dir "$env:USER_KRE_PATH\alias\*.txt" | ForEach-Object {
$_ | Should Not Contain $name
}
}
}
}