@@ -91,31 +91,59 @@ Describe UpdateModuleFromAlternateRepo -Tags 'BVT' {
91
91
PSGetTestUtils\Uninstall-Module ContosoClient
92
92
}
93
93
94
- It " Check situation " {
94
+ It " Check that removing a slash from a repo doesn't break update " {
95
95
$withSlash = " https://www.poshtestgallery.com/api/v2/"
96
96
$noSlash = " https://www.poshtestgallery.com/api/v2"
97
- Write-Host (Get-PSRepository | Out-String )
97
+ # Write-Host (Get-PSRepository | Out-String)
98
98
(Get-PSRepository PSGallery).SourceLocation | Should Be $withSlash
99
99
100
100
Install-Module ContosoServer - RequiredVersion 1.0
101
101
(Get-InstalledModule ContosoServer).RepositorySourceLocation | Should Be $withSlash
102
- Write-Host (Get-InstalledModule ContosoServer - AllVersions | Format-List | Out-String )
102
+ # Write-Host (Get-InstalledModule ContosoServer -AllVersions | Format-List | Out-String)
103
103
104
104
# now update where PSGallery Source Location is
105
105
Set-PSGallerySourceLocation - Location $noSlash
106
- Write-Host (Get-PSRepository | Out-String )
106
+ # Write-Host (Get-PSRepository | Out-String)
107
107
(Get-PSRepository PSGallery).SourceLocation | Should Be $noSlash
108
108
109
109
# reload powershellget to force-update cached repository info
110
110
Import-Module PowerShellGet - Force
111
111
112
112
# now try and update module isntalled using other SourceLocation
113
113
Update-Module ContosoServer - RequiredVersion 2.0 - ErrorAction Stop
114
- Write-Host (Get-InstalledModule ContosoServer - AllVersions | Format-List | Out-String )
114
+ # Write-Host (Get-InstalledModule ContosoServer -AllVersions | Format-List | Out-String)
115
115
(Get-InstalledModule ContosoServer).RepositorySourceLocation | Should Be $noSlash
116
116
117
117
(Get-InstalledModule ContosoServer).Version | Should Be 2.0
118
+ }
119
+
120
+ It " Check that adding a slash to a repo doesn't break update" {
121
+ $withSlash = " https://www.poshtestgallery.com/api/v2/"
122
+ $noSlash = " https://www.poshtestgallery.com/api/v2"
123
+ # Write-Host (Get-PSRepository | Out-String)
124
+
125
+ Set-PSGallerySourceLocation - Location $noSlash
126
+
127
+ (Get-PSRepository PSGallery).SourceLocation | Should Be $noSlash
128
+
129
+ Install-Module ContosoServer - RequiredVersion 1.0
130
+ (Get-InstalledModule ContosoServer).RepositorySourceLocation | Should Be $noSlash
131
+ # Write-Host (Get-InstalledModule ContosoServer -AllVersions | Format-List | Out-String)
118
132
133
+ # now update where PSGallery Source Location is
134
+ Set-PSGallerySourceLocation - Location $withSlash
135
+ # Write-Host (Get-PSRepository | Out-String)
136
+ (Get-PSRepository PSGallery).SourceLocation | Should Be $withSlash
137
+
138
+ # reload powershellget to force-update cached repository info
139
+ Import-Module PowerShellGet - Force
140
+
141
+ # now try and update module isntalled using other SourceLocation
142
+ Update-Module ContosoServer - RequiredVersion 2.0 - ErrorAction Stop
143
+ # Write-Host (Get-InstalledModule ContosoServer -AllVersions | Format-List | Out-String)
144
+ (Get-InstalledModule ContosoServer).RepositorySourceLocation | Should Be $withSlash
145
+
146
+ (Get-InstalledModule ContosoServer).Version | Should Be 2.0
119
147
}
120
148
}
121
149
0 commit comments