|
17 | 17 | package cdi |
18 | 18 |
|
19 | 19 | import ( |
| 20 | + "runtime" |
20 | 21 | "testing" |
21 | 22 |
|
22 | 23 | oci "github.com/opencontainers/runtime-spec/specs-go" |
@@ -303,6 +304,13 @@ func TestValidateContainerEdits(t *testing.T) { |
303 | 304 | } |
304 | 305 |
|
305 | 306 | func TestApplyContainerEdits(t *testing.T) { |
| 307 | + nullDeviceMajor := int64(1) |
| 308 | + nullDeviceMinor := int64(3) |
| 309 | + if runtime.GOOS == "darwin" { |
| 310 | + nullDeviceMajor = 3 |
| 311 | + nullDeviceMinor = 2 |
| 312 | + } |
| 313 | + |
306 | 314 | type testCase struct { |
307 | 315 | name string |
308 | 316 | spec *oci.Spec |
@@ -346,17 +354,17 @@ func TestApplyContainerEdits(t *testing.T) { |
346 | 354 | { |
347 | 355 | Path: "/dev/null", |
348 | 356 | Type: "c", |
349 | | - Major: 1, |
350 | | - Minor: 3, |
| 357 | + Major: nullDeviceMajor, |
| 358 | + Minor: nullDeviceMinor, |
351 | 359 | }, |
352 | 360 | }, |
353 | 361 | Resources: &oci.LinuxResources{ |
354 | 362 | Devices: []oci.LinuxDeviceCgroup{ |
355 | 363 | { |
356 | 364 | Allow: true, |
357 | 365 | Type: "c", |
358 | | - Major: int64ptr(1), |
359 | | - Minor: int64ptr(3), |
| 366 | + Major: &nullDeviceMajor, |
| 367 | + Minor: &nullDeviceMinor, |
360 | 368 | Access: "rwm", |
361 | 369 | }, |
362 | 370 | }, |
@@ -389,17 +397,17 @@ func TestApplyContainerEdits(t *testing.T) { |
389 | 397 | { |
390 | 398 | Path: "/dev/null", |
391 | 399 | Type: "c", |
392 | | - Major: 1, |
393 | | - Minor: 3, |
| 400 | + Major: nullDeviceMajor, |
| 401 | + Minor: nullDeviceMinor, |
394 | 402 | }, |
395 | 403 | }, |
396 | 404 | Resources: &oci.LinuxResources{ |
397 | 405 | Devices: []oci.LinuxDeviceCgroup{ |
398 | 406 | { |
399 | 407 | Allow: true, |
400 | 408 | Type: "c", |
401 | | - Major: int64ptr(1), |
402 | | - Minor: int64ptr(3), |
| 409 | + Major: &nullDeviceMajor, |
| 410 | + Minor: &nullDeviceMinor, |
403 | 411 | Access: "rwm", |
404 | 412 | }, |
405 | 413 | }, |
|
0 commit comments