From 3edb51d5456169fd464593090d502e86ff077c57 Mon Sep 17 00:00:00 2001 From: Amber Erickson Date: Wed, 28 Jul 2021 16:05:31 -0700 Subject: [PATCH 1/3] Add fix for failing MacOS tests --- test/InstallPSResource.Tests.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/InstallPSResource.Tests.ps1 b/test/InstallPSResource.Tests.ps1 index 0a3a245c8..754dc5dfe 100644 --- a/test/InstallPSResource.Tests.ps1 +++ b/test/InstallPSResource.Tests.ps1 @@ -154,9 +154,10 @@ Describe 'Test Install-PSResource for Module' { Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope CurrentUser $pkg = Get-Module "TestModule" -ListAvailable $pkg.Name | Should -Be "TestModule" - $pkg.Path.Contains("/home/") | Should -Be $true + $pkg.Path.Contains("$env:HOME/.local") | Should -Be $true } +<## manually test only # Unix only # Expected path should be similar to: '/usr/local/share/powershell/Modules' It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) { @@ -165,6 +166,7 @@ Describe 'Test Install-PSResource for Module' { $pkg.Name | Should -Be "TestModule" $pkg.Path.Contains("/usr/") | Should -Be $true } +#> # Unix only # Expected path should be similar to: '/home/janelane/.local/share/powershell/Modules' @@ -172,7 +174,7 @@ Describe 'Test Install-PSResource for Module' { Install-PSResource -Name "TestModule" -Repository $TestGalleryName $pkg = Get-Module "TestModule" -ListAvailable $pkg.Name | Should -Be "TestModule" - $pkg.Path.Contains("/home/") | Should -Be $true + $pkg.Path.Contains("$env:HOME/.local") | Should -Be $true } It "Should not install resource that is already installed" { From df8958681eb7296103d6178728cc51e9af4de299 Mon Sep 17 00:00:00 2001 From: Amber Erickson Date: Wed, 28 Jul 2021 16:30:54 -0700 Subject: [PATCH 2/3] Add describe block for non-CI run tests --- test/InstallPSResource.Tests.ps1 | 43 ++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/test/InstallPSResource.Tests.ps1 b/test/InstallPSResource.Tests.ps1 index 754dc5dfe..08460b62b 100644 --- a/test/InstallPSResource.Tests.ps1 +++ b/test/InstallPSResource.Tests.ps1 @@ -157,17 +157,6 @@ Describe 'Test Install-PSResource for Module' { $pkg.Path.Contains("$env:HOME/.local") | Should -Be $true } -<## manually test only - # Unix only - # Expected path should be similar to: '/usr/local/share/powershell/Modules' - It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) { - Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope AllUsers - $pkg = Get-Module "TestModule" -ListAvailable - $pkg.Name | Should -Be "TestModule" - $pkg.Path.Contains("/usr/") | Should -Be $true - } -#> - # Unix only # Expected path should be similar to: '/home/janelane/.local/share/powershell/Modules' It "Install resource under no specified scope - Unix only" -Skip:(Get-IsWindows) { @@ -237,8 +226,36 @@ Describe 'Test Install-PSResource for Module' { $pkg | Should -Not -BeNullOrEmpty $pkg.Name | Should -Be $publishModuleName } +} + +<# Temporarily commented until -Tag is implemented for this Describe block +Describe 'Test Install-PSResource for interactive and root user scenarios' { + + BeforeAll{ + $TestGalleryName = Get-PoshTestGalleryName + $PSGalleryName = Get-PSGalleryName + $NuGetGalleryName = Get-NuGetGalleryName + Get-NewPSResourceRepositoryFile + Register-LocalRepos + } + + AfterEach { + Uninstall-PSResource "TestModule", "testModuleWithlicense" -Force -ErrorAction SilentlyContinue + } + + AfterAll { + Get-RevertPSResourceRepositoryFile + } + + # Unix only manual test + # Expected path should be similar to: '/usr/local/share/powershell/Modules' + It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) { + Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope AllUsers + $pkg = Get-Module "TestModule" -ListAvailable + $pkg.Name | Should -Be "TestModule" + $pkg.Path.Contains("/usr/") | Should -Be $true + } -<# # This needs to be manually tested due to prompt It "Install resource that requires accept license without -AcceptLicense flag" { Install-PSResource -Name "testModuleWithlicense" -Repository $TestGalleryName @@ -258,5 +275,5 @@ Describe 'Test Install-PSResource for Module' { Set-PSResourceRepository PoshTestGallery -Trusted } -#> } +#> \ No newline at end of file From 082bb6da66db7177a5357bf6e6d27cada8d50b55 Mon Sep 17 00:00:00 2001 From: alerickson <25858831+alerickson@users.noreply.github.com> Date: Wed, 28 Jul 2021 17:31:53 -0700 Subject: [PATCH 3/3] Add new line to end of file --- test/InstallPSResource.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/InstallPSResource.Tests.ps1 b/test/InstallPSResource.Tests.ps1 index 08460b62b..33bc966af 100644 --- a/test/InstallPSResource.Tests.ps1 +++ b/test/InstallPSResource.Tests.ps1 @@ -276,4 +276,4 @@ Describe 'Test Install-PSResource for interactive and root user scenarios' { Set-PSResourceRepository PoshTestGallery -Trusted } } -#> \ No newline at end of file +#>