Skip to content

Commit 88dcae4

Browse files
authored
Add fix for failing unix tests (#426)
1 parent 9644bd9 commit 88dcae4

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

test/InstallPSResource.Tests.ps1

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,7 @@ Describe 'Test Install-PSResource for Module' {
154154
Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope CurrentUser
155155
$pkg = Get-Module "TestModule" -ListAvailable
156156
$pkg.Name | Should -Be "TestModule"
157-
$pkg.Path.Contains("/home/") | Should -Be $true
158-
}
159-
160-
# Unix only
161-
# Expected path should be similar to: '/usr/local/share/powershell/Modules'
162-
It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) {
163-
Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope AllUsers
164-
$pkg = Get-Module "TestModule" -ListAvailable
165-
$pkg.Name | Should -Be "TestModule"
166-
$pkg.Path.Contains("/usr/") | Should -Be $true
157+
$pkg.Path.Contains("$env:HOME/.local") | Should -Be $true
167158
}
168159

169160
# Unix only
@@ -172,7 +163,7 @@ Describe 'Test Install-PSResource for Module' {
172163
Install-PSResource -Name "TestModule" -Repository $TestGalleryName
173164
$pkg = Get-Module "TestModule" -ListAvailable
174165
$pkg.Name | Should -Be "TestModule"
175-
$pkg.Path.Contains("/home/") | Should -Be $true
166+
$pkg.Path.Contains("$env:HOME/.local") | Should -Be $true
176167
}
177168

178169
It "Should not install resource that is already installed" {
@@ -235,8 +226,36 @@ Describe 'Test Install-PSResource for Module' {
235226
$pkg | Should -Not -BeNullOrEmpty
236227
$pkg.Name | Should -Be $publishModuleName
237228
}
229+
}
230+
231+
<# Temporarily commented until -Tag is implemented for this Describe block
232+
Describe 'Test Install-PSResource for interactive and root user scenarios' {
233+
234+
BeforeAll{
235+
$TestGalleryName = Get-PoshTestGalleryName
236+
$PSGalleryName = Get-PSGalleryName
237+
$NuGetGalleryName = Get-NuGetGalleryName
238+
Get-NewPSResourceRepositoryFile
239+
Register-LocalRepos
240+
}
241+
242+
AfterEach {
243+
Uninstall-PSResource "TestModule", "testModuleWithlicense" -Force -ErrorAction SilentlyContinue
244+
}
245+
246+
AfterAll {
247+
Get-RevertPSResourceRepositoryFile
248+
}
249+
250+
# Unix only manual test
251+
# Expected path should be similar to: '/usr/local/share/powershell/Modules'
252+
It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) {
253+
Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope AllUsers
254+
$pkg = Get-Module "TestModule" -ListAvailable
255+
$pkg.Name | Should -Be "TestModule"
256+
$pkg.Path.Contains("/usr/") | Should -Be $true
257+
}
238258
239-
<#
240259
# This needs to be manually tested due to prompt
241260
It "Install resource that requires accept license without -AcceptLicense flag" {
242261
Install-PSResource -Name "testModuleWithlicense" -Repository $TestGalleryName
@@ -256,5 +275,5 @@ Describe 'Test Install-PSResource for Module' {
256275
257276
Set-PSResourceRepository PoshTestGallery -Trusted
258277
}
259-
#>
260278
}
279+
#>

0 commit comments

Comments
 (0)