@@ -2,6 +2,9 @@ function setUpScript {
22 $base_url = " $ ( $pwd.Path ) \tests\testarea"
33}
44
5+ # Since this one is going out and getting the actual latest, we don't know
6+ # exactly what it will return. So, we're just checking that it returned
7+ # something and that it got a hash, filename, and url
58function test_Get-SaltPackageInfo_online_default {
69 $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
710 $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
@@ -14,7 +17,7 @@ function test_Get-SaltPackageInfo_online_default {
1417 return $failed
1518}
1619
17- function test_Get-SaltPackageInfo_online_version {
20+ function test_Get-SaltPackageInfo_online_exact_version {
1821 $MinionVersion = " 3006.1"
1922 $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
2023 $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
@@ -57,6 +60,7 @@ function test_Get-SaltPackageInfo_local_version{
5760 $base_url = " $ ( $pwd.Path ) \tests\testarea"
5861 $MinionVersion = " 3006.1"
5962 $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
63+ if ( $test.version -ne $MinionVersion ) { $failed = 1 }
6064 $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
6165 $exp_url = " $base_url /$ ( $test.version ) /$exp_name "
6266 $failed = 0
@@ -71,6 +75,7 @@ function test_Get-SaltPackageInfo_local_major_version{
7175 $base_url = " $ ( $pwd.Path ) \tests\testarea"
7276 $MinionVersion = " 3006"
7377 $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
78+ if ( $test.version -ne " 3006.10" ) { $failed = 1 }
7479 $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
7580 $exp_url = " $base_url /$ ( $test.version ) /$exp_name "
7681 $failed = 0
@@ -80,3 +85,47 @@ function test_Get-SaltPackageInfo_local_major_version{
8085 if ( $test.url -ne $exp_url ) { $failed = 1 }
8186 return $failed
8287}
88+
89+ # testarea includes 3006.10 (GA) and 3006.10rc1 (prerelease). Global "latest"
90+ # stays 3007.1; major "3006" picks GA 3006.10; exact "3006.10rc1" picks the RC dir.
91+ function test_Get-SaltPackageInfo_local_latest_unchanged_when_rc_not_highest_ga {
92+ $base_url = " $ ( $pwd.Path ) \tests\testarea"
93+ $MinionVersion = " latest"
94+ $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
95+ $failed = 0
96+ if ( $test.version -ne " 3007.1" ) { $failed = 1 }
97+ $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
98+ $exp_url = " $base_url /$ ( $test.version ) /$exp_name "
99+ if ( $test.file_name -ne $exp_name ) { $failed = 1 }
100+ if ( $test.url -ne $exp_url ) { $failed = 1 }
101+ if ( $test.hash.Length -ne 64 ) { $failed = 1 }
102+ return $failed
103+ }
104+
105+ function test_Get-SaltPackageInfo_local_major_3006_resolves_to_ga_not_rc {
106+ $base_url = " $ ( $pwd.Path ) \tests\testarea"
107+ $MinionVersion = " 3006"
108+ $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
109+ $failed = 0
110+ if ( $test.version -ne " 3006.10" ) { $failed = 1 }
111+ $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
112+ $exp_url = " $base_url /$ ( $test.version ) /$exp_name "
113+ if ( $test.file_name -ne $exp_name ) { $failed = 1 }
114+ if ( $test.url -ne $exp_url ) { $failed = 1 }
115+ if ( $test.hash.Length -notin 0 , 64 ) { $failed = 1 }
116+ return $failed
117+ }
118+
119+ function test_Get-SaltPackageInfo_local_exact_rc_version {
120+ $base_url = " $ ( $pwd.Path ) \tests\testarea"
121+ $MinionVersion = " 3006.10rc1"
122+ $test = Get-SaltPackageInfo - MinionVersion $MinionVersion
123+ $failed = 0
124+ if ( $test.version -ne " 3006.10rc1" ) { $failed = 1 }
125+ $exp_name = " salt-$ ( $test.version ) -onedir-windows-amd64.zip"
126+ $exp_url = " $base_url /$ ( $test.version ) /$exp_name "
127+ if ( $test.file_name -ne $exp_name ) { $failed = 1 }
128+ if ( $test.url -ne $exp_url ) { $failed = 1 }
129+ if ( $test.hash.Length -notin 0 , 64 ) { $failed = 1 }
130+ return $failed
131+ }
0 commit comments