Skip to content

Commit 5cfc4a8

Browse files
committed
Enable some image-pull tests on Windows
Now that they are using a multi-arch image, they should work on Windows like they work elsewhere. This also means non-AMD64 platforms do this test with their native platform version, not the linux/amd64 platform version. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
1 parent b375f90 commit 5cfc4a8

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

integration/client/image_test.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ import (
3131
)
3232

3333
func TestImageIsUnpacked(t *testing.T) {
34-
if runtime.GOOS == "windows" {
35-
t.Skip()
36-
}
37-
3834
const imageName = "k8s.gcr.io/pause:3.4.1"
3935
ctx, cancel := testContext(t)
4036
defer cancel()
@@ -53,7 +49,7 @@ func TestImageIsUnpacked(t *testing.T) {
5349
}
5450

5551
// By default pull does not unpack an image
56-
image, err := client.Pull(ctx, imageName, WithPlatform("linux/amd64"))
52+
image, err := client.Pull(ctx, imageName, WithPlatformMatcher(platforms.Default()))
5753
if err != nil {
5854
t.Fatal(err)
5955
}
@@ -82,9 +78,6 @@ func TestImageIsUnpacked(t *testing.T) {
8278
}
8379

8480
func TestImagePullWithDistSourceLabel(t *testing.T) {
85-
if runtime.GOOS == "windows" {
86-
t.Skip()
87-
}
8881
var (
8982
source = "k8s.gcr.io"
9083
repoName = "pause"
@@ -140,7 +133,7 @@ func TestImagePullWithDistSourceLabel(t *testing.T) {
140133
}
141134

142135
func TestImageUsage(t *testing.T) {
143-
if testing.Short() || runtime.GOOS == "windows" {
136+
if testing.Short() {
144137
t.Skip()
145138
}
146139

@@ -160,13 +153,10 @@ func TestImageUsage(t *testing.T) {
160153
t.Fatal(err)
161154
}
162155

163-
testPlatform := platforms.Only(ocispec.Platform{
164-
OS: "linux",
165-
Architecture: "amd64",
166-
})
156+
pMatcher := platforms.Default()
167157

168158
// Pull single platform, do not unpack
169-
image, err := client.Pull(ctx, imageName, WithPlatformMatcher(testPlatform))
159+
image, err := client.Pull(ctx, imageName, WithPlatformMatcher(pMatcher))
170160
if err != nil {
171161
t.Fatal(err)
172162
}
@@ -187,7 +177,7 @@ func TestImageUsage(t *testing.T) {
187177
defer client.ImageService().Delete(ctx, imageName, images.SynchronousDelete())
188178

189179
// Fetch single platforms, but all manifests pulled
190-
if _, err := client.Fetch(ctx, imageName, WithPlatformMatcher(testPlatform), WithAllMetadata()); err != nil {
180+
if _, err := client.Fetch(ctx, imageName, WithPlatformMatcher(pMatcher), WithAllMetadata()); err != nil {
191181
t.Fatal(err)
192182
}
193183

0 commit comments

Comments
 (0)