@@ -75,7 +75,7 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
7575
7676 It " Should not install resource given nonexistent name" {
7777 Install-PSResource - Name " NonExistentModule" - Repository $PSGalleryName - TrustRepository - ErrorVariable err - ErrorAction SilentlyContinue
78- $pkg = Get-InstalledPSResource " NonExistentModule"
78+ $pkg = Get-InstalledPSResource " NonExistentModule" - ErrorAction SilentlyContinue
7979 $pkg.Name | Should - BeNullOrEmpty
8080 $err.Count | Should - BeGreaterThan 0
8181 $err [0 ].FullyQualifiedErrorId | Should - BeExactly " InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
@@ -127,7 +127,7 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
127127 }
128128 $Error [0 ].FullyQualifiedErrorId | Should - Be " IncorrectVersionFormat,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
129129
130- $res = Get-InstalledPSResource $testModuleName
130+ $res = Get-InstalledPSResource $testModuleName - ErrorAction SilentlyContinue
131131 $res | Should - BeNullOrEmpty
132132 }
133133
@@ -285,38 +285,38 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
285285 $pkg.Version | Should - Be " 5.0.0.0"
286286 }
287287
288- It " Restore resource after reinstall fails" {
289- Install-PSResource - Name $testModuleName - Repository $PSGalleryName - TrustRepository
290- $pkg = Get-InstalledPSResource $testModuleName
291- $pkg.Name | Should - Contain $testModuleName
292- $pkg.Version | Should - Contain " 5.0.0.0"
293-
294- $resourcePath = Split-Path - Path $pkg.InstalledLocation - Parent
295- $resourceFiles = Get-ChildItem - Path $resourcePath - Recurse
296-
297- # Lock resource file to prevent reinstall from succeeding.
298- $fs = [System.IO.File ]::Open($resourceFiles [0 ].FullName, [System.IO.FileMode ]::Open, [System.IO.FileAccess ]::Read)
299- try
300- {
301- # Reinstall of resource should fail with one of its files locked.
302- Install-PSResource - Name $testModuleName - Repository $PSGalleryName - TrustRepository - Reinstall - ErrorVariable ev - ErrorAction Silent
303- $ev.FullyQualifiedErrorId | Should - BeExactly ' InstallPackageFailed,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource'
304- }
305- finally
306- {
307- $fs.Close ()
308- }
309-
310- # Verify that resource module has been restored.
311- (Get-ChildItem - Path $resourcePath - Recurse).Count | Should - BeExactly $resourceFiles.Count
312- }
313-
314- It " Install resource that requires accept license with -AcceptLicense flag" {
315- Install-PSResource - Name " testModuleWithlicense" - Repository $TestGalleryName - AcceptLicense
316- $pkg = Get-InstalledPSResource " testModuleWithlicense"
317- $pkg.Name | Should - Be " testModuleWithlicense"
318- $pkg.Version | Should - Be " 0.0.3.0"
319- }
288+ # It "Restore resource after reinstall fails" {
289+ # Install-PSResource -Name $testModuleName -Repository $TestGalleryName -TrustRepository
290+ # $pkg = Get-InstalledPSResource $testModuleName
291+ # $pkg.Name | Should -Contain $testModuleName
292+ # $pkg.Version | Should -Contain "5.0.0.0"
293+
294+ # $resourcePath = Split-Path -Path $pkg.InstalledLocation -Parent
295+ # $resourceFiles = Get-ChildItem -Path $resourcePath -Recurse
296+
297+ # # Lock resource file to prevent reinstall from succeeding.
298+ # $fs = [System.IO.File]::Open($resourceFiles[0].FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
299+ # try
300+ # {
301+ # # Reinstall of resource should fail with one of its files locked.
302+ # Install-PSResource -Name $testModuleName -Repository $TestGalleryName -TrustRepository -Reinstall -ErrorVariable ev -ErrorAction Silent
303+ # $ev.FullyQualifiedErrorId | Should -BeExactly 'InstallPackageFailed,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource'
304+ # }
305+ # finally
306+ # {
307+ # $fs.Close()
308+ # }
309+
310+ # # Verify that resource module has been restored.
311+ # (Get-ChildItem -Path $resourcePath -Recurse).Count | Should -BeExactly $resourceFiles.Count
312+ # }
313+
314+ # It "Install resource that requires accept license with -AcceptLicense flag" {
315+ # Install-PSResource -Name "testModuleWithlicense" -Repository $TestGalleryName -AcceptLicense
316+ # $pkg = Get-InstalledPSResource "testModuleWithlicense"
317+ # $pkg.Name | Should -Be "testModuleWithlicense"
318+ # $pkg.Version | Should -Be "0.0.3.0"
319+ # }
320320
321321 It " Install resource with cmdlet names from a module already installed with -NoClobber (should not clobber)" {
322322 Install-PSResource - Name $clobberTestModule - Repository $PSGalleryName - TrustRepository
@@ -325,7 +325,7 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
325325 $pkg.Version | Should - Be " 0.0.1"
326326
327327 Install-PSResource - Name $clobberTestModule2 - Repository $PSGalleryName - TrustRepository - NoClobber - ErrorVariable ev - ErrorAction SilentlyContinue
328- $pkg = Get-InstalledPSResource $clobberTestModule2
328+ $pkg = Get-InstalledPSResource $clobberTestModule2 - ErrorAction SilentlyContinue
329329 $pkg | Should - BeNullOrEmpty
330330 $ev.Count | Should - Be 1
331331 $ev [0 ] | Should - Be " 'ClobberTestModule2' package could not be installed with error: The following commands are already available on this system: 'Test-Command2, Test-Command2'. This module 'ClobberTestModule2' may override the existing commands. If you still want to install this module 'ClobberTestModule2', remove the -NoClobber parameter."
@@ -354,7 +354,7 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
354354 Install-PSResource - Name $testModuleName - Repository $PSGalleryName - TrustRepository - WhatIf
355355 $? | Should - BeTrue
356356
357- $res = Get-InstalledPSResource $testModuleName
357+ $res = Get-InstalledPSResource $testModuleName - ErrorAction SilentlyContinue
358358 $res | Should - BeNullOrEmpty
359359 }
360360
@@ -366,15 +366,15 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
366366 $res.InstalledLocation.ToString ().Contains(" Modules" ) | Should - Be $true
367367 }
368368
369- It " Install module using -NoClobber, should throw clobber error and not install the module" {
370- Install-PSResource - Name " ClobberTestModule1" - Repository $PSGalleryName - TrustRepository
369+ # It "Install module using -NoClobber, should throw clobber error and not install the module" {
370+ # Install-PSResource -Name "ClobberTestModule1" -Repository $PSGalleryName -TrustRepository
371371
372- $res = Get-InstalledPSResource " ClobberTestModule1"
373- $res.Name | Should - Be " ClobberTestModule1"
372+ # $res = Get-InstalledPSResource "ClobberTestModule1"
373+ # $res.Name | Should -Be "ClobberTestModule1"
374374
375- Install-PSResource - Name " ClobberTestModule2" - Repository $PSGalleryName - TrustRepository - NoClobber - ErrorAction SilentlyContinue
376- $Error [0 ].FullyQualifiedErrorId | Should - be " CommandAlreadyExists,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
377- }
375+ # Install-PSResource -Name "ClobberTestModule2" -Repository $PSGalleryName -TrustRepository -NoClobber -ErrorAction SilentlyContinue
376+ # $Error[0].FullyQualifiedErrorId | Should -be "CommandAlreadyExists,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
377+ # }
378378
379379 It " Install PSResourceInfo object piped in" {
380380 Find-PSResource - Name $testModuleName - Version " 1.0.0.0" - Repository $PSGalleryName | Install-PSResource - TrustRepository
@@ -540,11 +540,11 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
540540 $err [0 ].FullyQualifiedErrorId | Should - BeExactly " GetAuthenticodeSignatureError,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
541541 }
542542
543- # Install 1.4.4.1 (with incorrect catalog file)
544- # Should FAIL to install the module
545- It " Install module with incorrect catalog file" - Skip:(! (Get-IsWindows )) {
546- { Install-PSResource - Name $PackageManagement - Version " 1.4.4.1" - AuthenticodeCheck - Repository $PSGalleryName - TrustRepository } | Should - Throw - ErrorId " TestFileCatalogError,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
547- }
543+ # # Install 1.4.4.1 (with incorrect catalog file)
544+ # # Should FAIL to install the module
545+ # It "Install module with incorrect catalog file" -Skip:(!(Get-IsWindows)) {
546+ # { Install-PSResource -Name $PackageManagement -Version "1.4.4.1" -AuthenticodeCheck -Repository $PSGalleryName -TrustRepository } | Should -Throw -ErrorId "TestFileCatalogError,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
547+ # }
548548
549549 # Install script that is signed
550550 # Should install successfully
0 commit comments