@@ -77,6 +77,48 @@ function SuiteCleanup {
77
77
}
78
78
}
79
79
80
+ Describe UpdateModuleFromAlternateRepo - Tags ' BVT' {
81
+ BeforeAll {
82
+ SuiteSetup
83
+ }
84
+
85
+ AfterAll {
86
+ SuiteCleanup
87
+ }
88
+
89
+ AfterEach {
90
+ PSGetTestUtils\Uninstall-Module ContosoServer
91
+ PSGetTestUtils\Uninstall-Module ContosoClient
92
+ }
93
+
94
+ It " Check situation" {
95
+ $withSlash = " https://www.poshtestgallery.com/api/v2/"
96
+ $noSlash = " https://www.poshtestgallery.com/api/v2"
97
+ Write-Host (Get-PSRepository | Out-String )
98
+ (Get-PSRepository PSGallery).SourceLocation | Should Be $withSlash
99
+
100
+ Install-Module ContosoServer - RequiredVersion 1.0
101
+ (Get-InstalledModule ContosoServer).RepositorySourceLocation | Should Be $withSlash
102
+ Write-Host (Get-InstalledModule ContosoServer - AllVersions | Format-List | Out-String )
103
+
104
+ # now update where PSGallery Source Location is
105
+ Set-PSGallerySourceLocation - Location $noSlash
106
+ Write-Host (Get-PSRepository | Out-String )
107
+ (Get-PSRepository PSGallery).SourceLocation | Should Be $noSlash
108
+
109
+ # reload powershellget to force-update cached repository info
110
+ Import-Module PowerShellGet - Force
111
+
112
+ # now try and update module isntalled using other SourceLocation
113
+ Update-Module ContosoServer - RequiredVersion 2.0 - ErrorAction Stop
114
+ Write-Host (Get-InstalledModule ContosoServer - AllVersions | Format-List | Out-String )
115
+ (Get-InstalledModule ContosoServer).RepositorySourceLocation | Should Be $noSlash
116
+
117
+ (Get-InstalledModule ContosoServer).Version | Should Be 2.0
118
+
119
+ }
120
+ }
121
+
80
122
Describe PowerShell.PSGet.UpdateModuleTests - Tags ' BVT' , ' InnerLoop' {
81
123
82
124
BeforeAll {
@@ -350,7 +392,7 @@ Describe PowerShell.PSGet.UpdateModuleTests -Tags 'BVT','InnerLoop' {
350
392
}
351
393
352
394
Describe PowerShell.PSGet.UpdateModuleTests.P1 - Tags ' P1' , ' OuterLoop' {
353
- # Not executing these tests on MacOS as
395
+ # Not executing these tests on MacOS as
354
396
# the total execution time is exceeding allowed 50 min in TravisCI daily builds.
355
397
if ($IsMacOS ) {
356
398
return
@@ -376,13 +418,13 @@ Describe PowerShell.PSGet.UpdateModuleTests.P1 -Tags 'P1','OuterLoop' {
376
418
# Expected Result: both modules should be refreshed
377
419
#
378
420
It " UpdateMultipleModulesWithWildcard" {
379
-
421
+
380
422
Install-Module ContosoClient - RequiredVersion 1.0
381
-
423
+
382
424
$contosoClientDetails = Get-InstalledModule - Name ContosoClient
383
425
384
426
Install-Module ContosoServer - RequiredVersion 1.0
385
-
427
+
386
428
$MyError = $null
387
429
$DateTimeBeforeUpdate = Get-Date
388
430
@@ -391,7 +433,7 @@ Describe PowerShell.PSGet.UpdateModuleTests.P1 -Tags 'P1','OuterLoop' {
391
433
Assert ($MyError.Count -eq 0 ) " There should not be any error when updating multiple modules with wildcard in name, $MyError "
392
434
$res = Get-InstalledModule - Name ContosoServer - MinimumVersion " 1.1"
393
435
Assert ($res -and ($res.Name -eq " ContosoServer" ) -and ($res.Version -gt [Version ]" 1.0" )) " Update-Module should update when wildcard specified in name"
394
-
436
+
395
437
$res = Get-InstalledModule - Name ContosoClient - MinimumVersion " 1.1"
396
438
Assert ($res -and ($res.Name -eq " ContosoClient" ) -and ($res.Version -gt [Version ]" 1.0" )) " Update-Module should update when wildcard specified in name"
397
439
@@ -457,7 +499,7 @@ Describe PowerShell.PSGet.UpdateModuleTests.P1 -Tags 'P1','OuterLoop' {
457
499
458
500
Describe PowerShell.PSGet.UpdateModuleTests.P2 - Tags ' P2' , ' OuterLoop' {
459
501
460
- # Not executing these tests on MacOS as
502
+ # Not executing these tests on MacOS as
461
503
# the total execution time is exceeding allowed 50 min in TravisCI daily builds.
462
504
if ($IsMacOS ) {
463
505
return
0 commit comments