Skip to content

Commit 2c01d53

Browse files
committed
image/cache: Use Platform from ocispec
Signed-off-by: Paweł Gronowski <[email protected]>
1 parent 203ffb1 commit 2c01d53

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

image/cache/compare_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"runtime"
55
"testing"
66

7-
"github.com/containerd/containerd/platforms"
87
"github.com/docker/docker/api/types/container"
98
"github.com/docker/docker/api/types/strslice"
109
"github.com/docker/go-connections/nat"
10+
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
1111
"gotest.tools/v3/assert"
1212
is "gotest.tools/v3/assert/cmp"
1313
)
@@ -132,63 +132,63 @@ func TestCompare(t *testing.T) {
132132
func TestPlatformCompare(t *testing.T) {
133133
for _, tc := range []struct {
134134
name string
135-
builder platforms.Platform
136-
image platforms.Platform
135+
builder ocispec.Platform
136+
image ocispec.Platform
137137
expected bool
138138
}{
139139
{
140140
name: "same os and arch",
141-
builder: platforms.Platform{Architecture: "amd64", OS: runtime.GOOS},
142-
image: platforms.Platform{Architecture: "amd64", OS: runtime.GOOS},
141+
builder: ocispec.Platform{Architecture: "amd64", OS: runtime.GOOS},
142+
image: ocispec.Platform{Architecture: "amd64", OS: runtime.GOOS},
143143
expected: true,
144144
},
145145
{
146146
name: "same os different arch",
147-
builder: platforms.Platform{Architecture: "amd64", OS: runtime.GOOS},
148-
image: platforms.Platform{Architecture: "arm64", OS: runtime.GOOS},
147+
builder: ocispec.Platform{Architecture: "amd64", OS: runtime.GOOS},
148+
image: ocispec.Platform{Architecture: "arm64", OS: runtime.GOOS},
149149
expected: false,
150150
},
151151
{
152152
name: "same os smaller host variant",
153-
builder: platforms.Platform{Variant: "v7", Architecture: "arm", OS: runtime.GOOS},
154-
image: platforms.Platform{Variant: "v8", Architecture: "arm", OS: runtime.GOOS},
153+
builder: ocispec.Platform{Variant: "v7", Architecture: "arm", OS: runtime.GOOS},
154+
image: ocispec.Platform{Variant: "v8", Architecture: "arm", OS: runtime.GOOS},
155155
expected: false,
156156
},
157157
{
158158
name: "same os higher host variant",
159-
builder: platforms.Platform{Variant: "v8", Architecture: "arm", OS: runtime.GOOS},
160-
image: platforms.Platform{Variant: "v7", Architecture: "arm", OS: runtime.GOOS},
159+
builder: ocispec.Platform{Variant: "v8", Architecture: "arm", OS: runtime.GOOS},
160+
image: ocispec.Platform{Variant: "v7", Architecture: "arm", OS: runtime.GOOS},
161161
expected: true,
162162
},
163163
{
164164
// Test for https://github.com/moby/moby/issues/47307
165165
name: "different build and revision",
166-
builder: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.22621"},
167-
image: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
166+
builder: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.22621"},
167+
image: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
168168
expected: true,
169169
},
170170
{
171171
name: "different revision",
172-
builder: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.1234"},
173-
image: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
172+
builder: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.1234"},
173+
image: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
174174
expected: true,
175175
},
176176
{
177177
name: "different major",
178-
builder: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "11.0.17763.5329"},
179-
image: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
178+
builder: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "11.0.17763.5329"},
179+
image: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
180180
expected: false,
181181
},
182182
{
183183
name: "different minor same osver",
184-
builder: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
185-
image: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.1.17763.5329"},
184+
builder: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
185+
image: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.1.17763.5329"},
186186
expected: false,
187187
},
188188
{
189189
name: "different arch same osver",
190-
builder: platforms.Platform{Architecture: "arm64", OS: "windows", OSVersion: "10.0.17763.5329"},
191-
image: platforms.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
190+
builder: ocispec.Platform{Architecture: "arm64", OS: "windows", OSVersion: "10.0.17763.5329"},
191+
image: ocispec.Platform{Architecture: "amd64", OS: "windows", OSVersion: "10.0.17763.5329"},
192192
expected: false,
193193
},
194194
} {

0 commit comments

Comments
 (0)