Skip to content

Commit 2c1e829

Browse files
committed
Add SilentlyContinue ErrorAction to tests
1 parent cbe4a10 commit 2c1e829

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test/InstallPSResourceTests/InstallPSResourceGithubPackages.Tests.ps1

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' {
3939
Install-PSResource -Name $Name -Repository $GithubPackagesRepoName -Credential $credential -ErrorVariable err -ErrorAction SilentlyContinue
4040
$err.Count | Should -BeGreaterThan 0
4141
$err[0].FullyQualifiedErrorId | Should -BeExactly "$ErrorId,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
42-
$res = Get-InstalledPSResource $testModuleName
42+
$res = Get-InstalledPSResource $testModuleName -ErrorAction SilentlyContinue
4343
$res | Should -BeNullOrEmpty
4444
}
4545

@@ -66,7 +66,7 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' {
6666

6767
It "Should not install resource given nonexistant name" {
6868
Install-PSResource -Name "NonExistantModule" -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository -ErrorVariable err -ErrorAction SilentlyContinue
69-
$pkg = Get-InstalledPSResource "NonExistantModule"
69+
$pkg = Get-InstalledPSResource "NonExistantModule" -ErrorAction SilentlyContinue
7070
$pkg | Should -BeNullOrEmpty
7171
$err.Count | Should -BeGreaterThan 0
7272
$err[0].FullyQualifiedErrorId | Should -BeExactly "InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
@@ -111,7 +111,7 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' {
111111
{}
112112
$Error[0].FullyQualifiedErrorId | Should -be "IncorrectVersionFormat,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource"
113113

114-
$res = Get-InstalledPSResource $testModuleName
114+
$res = Get-InstalledPSResource $testModuleName -ErrorAction SilentlyContinue
115115
$res | Should -BeNullOrEmpty
116116
}
117117

@@ -199,13 +199,13 @@ Describe 'Test Install-PSResource for GitHub packages' -tags 'CI' {
199199
}
200200

201201
It "Reinstall resource that is already installed with -Reinstall parameter" {
202-
Install-PSResource -Name $testModuleName -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository
203-
$pkg = Get-InstalledPSResource $testModuleName
204-
$pkg.Name | Should -Be $testModuleName
202+
Install-PSResource -Name $testModuleName2 -Repository $GithubPackagesRepoName -Credential $credential -TrustRepository
203+
$pkg = Get-InstalledPSResource $testModuleName2
204+
$pkg.Name | Should -Be $testModuleName2
205205
$pkg.Version | Should -Be "5.0.0"
206-
Install-PSResource -Name $testModuleName -Repository $GithubPackagesRepoName -Credential $credential -Reinstall -TrustRepository
207-
$pkg = Get-InstalledPSResource $testModuleName
208-
$pkg.Name | Should -Be $testModuleName
206+
Install-PSResource -Name $testModuleName2 -Repository $GithubPackagesRepoName -Credential $credential -Reinstall -TrustRepository
207+
$pkg = Get-InstalledPSResource $testModuleName2
208+
$pkg.Name | Should -Be $testModuleName2
209209
$pkg.Version | Should -Be "5.0.0"
210210
}
211211

@@ -248,23 +248,23 @@ Describe 'Test Install-PSResource for V3Server scenarios' -tags 'ManualValidatio
248248
$pkg.Path.Contains("/usr/") | Should -Be $true
249249
}
250250

251-
# This needs to be manually tested due to prompt
252-
It "Install resource that requires accept license without -AcceptLicense flag" {
253-
Install-PSResource -Name $testModuleName2 -Repository $TestGalleryName
254-
$pkg = Get-InstalledPSResource $testModuleName2
255-
$pkg.Name | Should -Be $testModuleName2
256-
$pkg.Version | Should -Be "0.0.1.0"
257-
}
251+
# # This needs to be manually tested due to prompt
252+
# It "Install resource that requires accept license without -AcceptLicense flag" {
253+
# Install-PSResource -Name $testModuleName2 -Repository $TestGalleryName
254+
# $pkg = Get-InstalledPSResource $testModuleName2
255+
# $pkg.Name | Should -Be $testModuleName2
256+
# $pkg.Version | Should -Be "0.0.1.0"
257+
# }
258258

259-
# This needs to be manually tested due to prompt
260-
It "Install resource should prompt 'trust repository' if repository is not trusted" {
261-
Set-PSResourceRepository PoshTestGallery -Trusted:$false
259+
# # This needs to be manually tested due to prompt
260+
# It "Install resource should prompt 'trust repository' if repository is not trusted" {
261+
# Set-PSResourceRepository PoshTestGallery -Trusted:$false
262262

263-
Install-PSResource -Name $testModuleName -Repository $TestGalleryName -confirm:$false
263+
# Install-PSResource -Name $testModuleName -Repository $TestGalleryName -confirm:$false
264264

265-
$pkg = Get-Module $testModuleName -ListAvailable
266-
$pkg.Name | Should -Be $testModuleName
265+
# $pkg = Get-Module $testModuleName -ListAvailable
266+
# $pkg.Name | Should -Be $testModuleName
267267

268-
Set-PSResourceRepository PoshTestGallery -Trusted
269-
}
268+
# Set-PSResourceRepository PoshTestGallery -Trusted
269+
# }
270270
}

0 commit comments

Comments
 (0)