@@ -10,6 +10,7 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' {
10
10
BeforeAll {
11
11
$testModuleName = " test-module"
12
12
$testModuleName2 = " test-module2"
13
+ $testModuleWith2DigitVersion = " test-2DigitPkg"
13
14
$testCamelCaseModuleName = " test-camelCaseModule"
14
15
$testCamelCaseScriptName = " test-camelCaseScript"
15
16
$testModuleParentName = " test_parent_mod"
@@ -33,7 +34,7 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' {
33
34
}
34
35
35
36
AfterEach {
36
- Uninstall-PSResource $testModuleName , $testModuleName2 , $testCamelCaseModuleName , $testScriptName , $testCamelCaseScriptName - Version " *" - SkipDependencyCheck - ErrorAction SilentlyContinue
37
+ Uninstall-PSResource $testModuleName , $testModuleName2 , $testCamelCaseModuleName , $testScriptName , $testCamelCaseScriptName , $testModuleWith2DigitVersion - Version " *" - SkipDependencyCheck - ErrorAction SilentlyContinue
37
38
}
38
39
39
40
AfterAll {
@@ -75,6 +76,47 @@ Describe 'Test Install-PSResource for ACR scenarios' -tags 'CI' {
75
76
$pkg.Version | Should - BeExactly " 1.0.0"
76
77
}
77
78
79
+ It " Install resource when version contains different number of digits than the normalized version- 1 digit specified" {
80
+ # the resource has version "1.0", but querying with any equivalent version should work
81
+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1" - Repository $ACRRepoName - TrustRepository
82
+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
83
+ $res | Should -Not - BeNullOrEmpty
84
+ $res.Version | Should - Be " 1.0"
85
+ }
86
+
87
+ It " Install resource when version contains different number of digits than the normalized version- 2 digits specified" {
88
+ # the resource has version "1.0", but querying with any equivalent version should work
89
+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.0" - Repository $ACRRepoName - TrustRepository
90
+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
91
+ $res | Should -Not - BeNullOrEmpty
92
+ $res.Version | Should - Be " 1.0"
93
+ }
94
+
95
+ It " Install resource when version contains different number of digits than the normalized version- 3 digits specified" {
96
+ # the resource has version "1.0", but querying with any equivalent version should work
97
+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.0.0" - Repository $ACRRepoName - TrustRepository
98
+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
99
+ $res | Should -Not - BeNullOrEmpty
100
+ $res.Version | Should - Be " 1.0"
101
+ }
102
+
103
+ It " Install resource when version contains different number of digits than the normalized version- 4 digits specified" {
104
+ # the resource has version "1.0", but querying with any equivalent version should work
105
+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.0.0.0" - Repository $ACRRepoName - TrustRepository
106
+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
107
+ $res | Should -Not - BeNullOrEmpty
108
+ $res.Version | Should - Be " 1.0"
109
+ }
110
+
111
+ It " Install resource where version specified is a prerelease version" {
112
+ # the resource has version "1.0", but querying with any equivalent version should work
113
+ Install-PSResource - Name $testModuleWith2DigitVersion - Version " 1.5-alpha" - Prerelease - Repository $ACRRepoName - TrustRepository
114
+ $res = Get-InstalledPSResource - Name $testModuleWith2DigitVersion
115
+ $res | Should -Not - BeNullOrEmpty
116
+ $res.Version | Should - Be " 1.5"
117
+ $res.Prerelease | Should - Be " alpha"
118
+ }
119
+
78
120
It " Install multiple resources by name" {
79
121
$pkgNames = @ ($testModuleName , $testModuleName2 )
80
122
Install-PSResource - Name $pkgNames - Repository $ACRRepoName - TrustRepository
0 commit comments