@@ -32,8 +32,6 @@ Describe "BuildkitTools.psm1" {
3232 function CleanupTestDrive {
3333 Get-ChildItem - Path " $TestDrive " - Force - ErrorAction SilentlyContinue | `
3434 Remove-Item - Recurse - Force - Confirm:$false - ErrorAction SilentlyContinue
35- Get-ChildItem - Path " TestDrive:\" - Recurse - Force - ErrorAction SilentlyContinue | `
36- Remove-Item - Recurse - Force - Confirm:$false - ErrorAction SilentlyContinue
3735 }
3836 }
3937
@@ -111,10 +109,10 @@ Describe "BuildkitTools.psm1" {
111109 }
112110
113111 It " Should call function with user-specified values" {
114- $customPath = " TestDrive: \Downloads\buildkit-v0.2.3.windows-amd64.tar.gz"
112+ $customPath = " $ TestDrive \Downloads\buildkit-v0.2.3.windows-amd64.tar.gz"
115113 Mock Get-InstallationFile - ModuleName ' BuildkitTools' - MockWith { return $customPath }
116114
117- Install-Buildkit - Version ' 0.2.3' - InstallPath ' TestDrive: \BuildKit' - DownloadPath ' TestDrive: \Downloads' - OSArchitecture " arm64" - Force - Confirm:$false
115+ Install-Buildkit - Version ' 0.2.3' - InstallPath " $ TestDrive \BuildKit" - DownloadPath " $ TestDrive \Downloads" - OSArchitecture " arm64" - Force - Confirm:$false
118116
119117 Should - Invoke Uninstall-Buildkit - ModuleName ' BuildkitTools' - Times 0 - Exactly - Scope It
120118 Should - Invoke Get-InstallationFile - ModuleName ' BuildkitTools' - ParameterFilter {
@@ -123,9 +121,9 @@ Describe "BuildkitTools.psm1" {
123121 }
124122 Should - Invoke Install-RequiredFeature - ModuleName ' BuildkitTools' - ParameterFilter {
125123 $Feature -eq " Buildkit" -and
126- $InstallPath -eq ' TestDrive: \BuildKit' -and
124+ $InstallPath -eq " $ TestDrive \BuildKit" -and
127125 $SourceFile -eq " $customPath " -and
128- $EnvPath -eq ' TestDrive: \Buildkit\bin' -and
126+ $EnvPath -eq " $ TestDrive \Buildkit\bin" -and
129127 $cleanup -eq $true
130128 }
131129 }
@@ -310,7 +308,7 @@ Describe "BuildkitTools.psm1" {
310308
311309 Context " Uninstall-Buildkit" - Tag " Uninstall-Buildkit" {
312310 BeforeAll {
313- Mock Get-DefaultInstallPath - ModuleName ' BuildkitTools' - MockWith { return ' TestDrive: \Program Files\Buildkit' }
311+ Mock Get-DefaultInstallPath - ModuleName ' BuildkitTools' - MockWith { return " $ TestDrive \Program Files\Buildkit" }
314312 Mock Test-EmptyDirectory - ModuleName ' BuildkitTools' - MockWith { return $false }
315313 Mock Stop-BuildkitdService - ModuleName ' BuildkitTools'
316314 Mock Unregister-Buildkitd - ModuleName ' BuildkitTools'
@@ -320,15 +318,15 @@ Describe "BuildkitTools.psm1" {
320318 }
321319
322320 It " Should successfully uninstall Buildkit" {
323- Uninstall-Buildkit - Path ' TestDrive: \Custom\Buildkit\' - Confirm:$false - Force
321+ Uninstall-Buildkit - Path " $ TestDrive \Custom\Buildkit\" - Confirm:$false - Force
324322
325323 # Should stop and deregister the buildkitd service
326324 Should - Invoke Stop-BuildkitdService - Times 1 - Scope It - ModuleName " BuildkitTools"
327325 Should - Invoke Unregister-Buildkitd - Times 1 - Scope It - ModuleName " BuildkitTools"
328326
329327 # Should remove buildkit dir
330328 Should - Invoke Remove-Item - Times 1 - Scope It - ModuleName " BuildkitTools" `
331- - ParameterFilter { $Path -eq ' TestDrive: \Custom\Buildkit\bin' }
329+ - ParameterFilter { $Path -eq " $ TestDrive \Custom\Buildkit\bin" }
332330
333331 # Should not purge program data
334332 Should - Invoke Remove-Item - Times 0 - Scope It - ModuleName " BuildkitTools" `
@@ -343,15 +341,15 @@ Describe "BuildkitTools.psm1" {
343341 Uninstall-Buildkit - Confirm:$false - Force
344342
345343 Should - Invoke Remove-Item - Times 0 - Scope It - ModuleName " BuildkitTools" `
346- - ParameterFilter { $Path -eq ' TestDrive: \Program Files\Buildkit\bin' }
344+ - ParameterFilter { $Path -eq " $ TestDrive \Program Files\Buildkit\bin" }
347345 }
348346
349347 It " Should successfully purge program data" {
350- Uninstall-Buildkit - Path ' TestDrive: \Program Files\Buildkit' - Confirm:$false - Force - Purge
348+ Uninstall-Buildkit - Path " $ TestDrive \Program Files\Buildkit" - Confirm:$false - Force - Purge
351349
352350 # Should purge program data
353351 Should - Invoke Remove-Item - Times 1 - Scope It - ModuleName " BuildkitTools" `
354- - ParameterFilter { $Path -eq ' TestDrive: \Program Files\Buildkit' }
352+ - ParameterFilter { $Path -eq " $ TestDrive \Program Files\Buildkit" }
355353 Should - Invoke Uninstall-ProgramFiles - Times 1 - Scope It - ModuleName " BuildkitTools" `
356354 - ParameterFilter { $Path -eq " $ENV: ProgramData \Buildkit" }
357355 Should - Invoke Remove-FeatureFromPath - Times 1 - Scope It - ModuleName " BuildkitTools" `
@@ -360,7 +358,7 @@ Describe "BuildkitTools.psm1" {
360358
361359 It " Should do nothing if user does not consent to uninstalling Buildkit" {
362360 $ENV: PESTER = $true
363- Uninstall-Buildkit - Path ' TestDrive: \Program Files\Buildkit' - Confirm:$false - Force:$false
361+ Uninstall-Buildkit - Path " $ TestDrive \Program Files\Buildkit" - Confirm:$false - Force:$false
364362
365363 # Should NOT stop and deregister the buildkit service
366364 Should - Invoke Stop-BuildkitdService - Times 0 - Scope It - ModuleName " BuildkitTools"
@@ -373,7 +371,7 @@ Describe "BuildkitTools.psm1" {
373371 It " Should do nothing if buildkit is not installed at specified path" {
374372 Mock Test-EmptyDirectory - ModuleName ' BuildkitTools' - MockWith { return $true }
375373
376- Uninstall-Buildkit - Path ' TestDrive: \Program Files\Buildkit' - Confirm:$false
374+ Uninstall-Buildkit - Path " $ TestDrive \Program Files\Buildkit" - Confirm:$false
377375
378376 Should - Invoke Stop-BuildkitdService - Times 0 - Scope It - ModuleName " BuildkitTools"
379377 Should - Invoke Unregister-Buildkitd - Times 0 - Scope It - ModuleName " BuildkitTools"
@@ -383,7 +381,7 @@ Describe "BuildkitTools.psm1" {
383381 It " Should throw an error if buildkitd service stop or unregister was unsuccessful" {
384382 Mock Stop-BuildkitdService - ModuleName ' BuildkitTools' - MockWith { Throw ' Error' }
385383
386- { Uninstall-Buildkit - Path ' TestDrive: \Program Files\Buildkit' - Confirm:$false - Force - Purge } | Should - Throw " *Could not stop or unregister buildkitd service.*"
384+ { Uninstall-Buildkit - Path " $ TestDrive \Program Files\Buildkit" - Confirm:$false - Force - Purge } | Should - Throw " *Could not stop or unregister buildkitd service.*"
387385 Should - Invoke Unregister-Buildkitd - Times 0 - Scope It - ModuleName " BuildkitTools"
388386 Should - Invoke Remove-Item - Times 0 - Scope It - ModuleName " BuildkitTools"
389387 Should - Invoke Remove-FeatureFromPath - Times 0 - Scope It - ModuleName " BuildkitTools"
0 commit comments