@@ -142,6 +142,110 @@ func TestMatchComparerMatch_WCOW(t *testing.T) {
142142 }
143143}
144144
145+ // TestMatchComparerMatch_ABICheckWCOW checks windows platform matcher
146+ // behavior for stable ABI and non-stable ABI compliant versions
147+ func TestMatchComparerMatch_ABICheckWCOW (t * testing.T ) {
148+ platformWS2019 := imagespec.Platform {
149+ Architecture : "amd64" ,
150+ OS : "windows" ,
151+ OSVersion : "10.0.17763" ,
152+ }
153+ platformWS2022 := imagespec.Platform {
154+ Architecture : "amd64" ,
155+ OS : "windows" ,
156+ OSVersion : "10.0.20348" ,
157+ }
158+ platformWindows11 := imagespec.Platform {
159+ Architecture : "amd64" ,
160+ OS : "windows" ,
161+ OSVersion : "10.0.22621" ,
162+ }
163+ matcherWS2019 := windowsmatcher {
164+ Platform : platformWS2019 ,
165+ osVersionPrefix : platformWS2019 .OSVersion ,
166+ defaultMatcher : & matcher {
167+ Platform : Normalize (platformWS2019 ),
168+ },
169+ }
170+ matcherWS2022 := windowsmatcher {
171+ Platform : platformWS2022 ,
172+ osVersionPrefix : platformWS2022 .OSVersion ,
173+ defaultMatcher : & matcher {
174+ Platform : Normalize (platformWS2022 ),
175+ },
176+ }
177+ matcherWindows11 := windowsmatcher {
178+ Platform : platformWindows11 ,
179+ osVersionPrefix : platformWindows11 .OSVersion ,
180+ defaultMatcher : & matcher {
181+ Platform : Normalize (platformWindows11 ),
182+ },
183+ }
184+
185+ for _ , test := range []struct {
186+ hostPlatformMatcher windowsmatcher
187+ testPlatform imagespec.Platform
188+ match bool
189+ }{
190+ {
191+ hostPlatformMatcher : matcherWS2019 ,
192+ testPlatform : imagespec.Platform {
193+ Architecture : "amd64" ,
194+ OS : "windows" ,
195+ OSVersion : "10.0.17763" ,
196+ },
197+ match : true ,
198+ },
199+ {
200+ hostPlatformMatcher : matcherWS2019 ,
201+ testPlatform : imagespec.Platform {
202+ Architecture : "amd64" ,
203+ OS : "windows" ,
204+ OSVersion : "10.0.20348" ,
205+ },
206+ match : false ,
207+ },
208+ {
209+ hostPlatformMatcher : matcherWS2022 ,
210+ testPlatform : imagespec.Platform {
211+ Architecture : "amd64" ,
212+ OS : "windows" ,
213+ OSVersion : "10.0.17763" ,
214+ },
215+ match : false ,
216+ },
217+ {
218+ hostPlatformMatcher : matcherWS2022 ,
219+ testPlatform : imagespec.Platform {
220+ Architecture : "amd64" ,
221+ OS : "windows" ,
222+ OSVersion : "10.0.20348" ,
223+ },
224+ match : true ,
225+ },
226+ {
227+ hostPlatformMatcher : matcherWindows11 ,
228+ testPlatform : imagespec.Platform {
229+ Architecture : "amd64" ,
230+ OS : "windows" ,
231+ OSVersion : "10.0.17763" ,
232+ },
233+ match : false ,
234+ },
235+ {
236+ hostPlatformMatcher : matcherWindows11 ,
237+ testPlatform : imagespec.Platform {
238+ Architecture : "amd64" ,
239+ OS : "windows" ,
240+ OSVersion : "10.0.20348" ,
241+ },
242+ match : true ,
243+ },
244+ } {
245+ assert .Equal (t , test .match , test .hostPlatformMatcher .Match (test .testPlatform ), "should match: %t, %s to %s" , test .match , test .hostPlatformMatcher .Platform , test .testPlatform )
246+ }
247+ }
248+
145249func TestMatchComparerMatch_LCOW (t * testing.T ) {
146250 major , minor , build := windows .RtlGetNtVersionNumbers ()
147251 buildStr := fmt .Sprintf ("%d.%d.%d" , major , minor , build )
0 commit comments