Skip to content

Commit faf587f

Browse files
committed
Fix failing tests on Darwin
Signed-off-by: Evan Lezar <[email protected]>
1 parent 4149a8a commit faf587f

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

pkg/cdi/cache_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"os"
2323
"path/filepath"
24+
"runtime"
2425
"strconv"
2526
"strings"
2627
"sync"
@@ -225,6 +226,9 @@ devices:
225226
}
226227

227228
func TestRefreshCache(t *testing.T) {
229+
if runtime.GOOS == "darwin" {
230+
t.Skip("skipping on darwin")
231+
}
228232
type specDirs struct {
229233
etc map[string]string
230234
run map[string]string

pkg/cdi/container-edits_test.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package cdi
1818

1919
import (
20+
"runtime"
2021
"testing"
2122

2223
oci "github.com/opencontainers/runtime-spec/specs-go"
@@ -303,6 +304,13 @@ func TestValidateContainerEdits(t *testing.T) {
303304
}
304305

305306
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+
306314
type testCase struct {
307315
name string
308316
spec *oci.Spec
@@ -346,17 +354,17 @@ func TestApplyContainerEdits(t *testing.T) {
346354
{
347355
Path: "/dev/null",
348356
Type: "c",
349-
Major: 1,
350-
Minor: 3,
357+
Major: nullDeviceMajor,
358+
Minor: nullDeviceMinor,
351359
},
352360
},
353361
Resources: &oci.LinuxResources{
354362
Devices: []oci.LinuxDeviceCgroup{
355363
{
356364
Allow: true,
357365
Type: "c",
358-
Major: int64ptr(1),
359-
Minor: int64ptr(3),
366+
Major: &nullDeviceMajor,
367+
Minor: &nullDeviceMinor,
360368
Access: "rwm",
361369
},
362370
},
@@ -389,17 +397,17 @@ func TestApplyContainerEdits(t *testing.T) {
389397
{
390398
Path: "/dev/null",
391399
Type: "c",
392-
Major: 1,
393-
Minor: 3,
400+
Major: nullDeviceMajor,
401+
Minor: nullDeviceMinor,
394402
},
395403
},
396404
Resources: &oci.LinuxResources{
397405
Devices: []oci.LinuxDeviceCgroup{
398406
{
399407
Allow: true,
400408
Type: "c",
401-
Major: int64ptr(1),
402-
Minor: int64ptr(3),
409+
Major: &nullDeviceMajor,
410+
Minor: &nullDeviceMinor,
403411
Access: "rwm",
404412
},
405413
},

pkg/cdi/default-cache_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package cdi
1919
import (
2020
"fmt"
2121
"path/filepath"
22+
"runtime"
2223
"testing"
2324
"time"
2425

@@ -129,6 +130,9 @@ devices:
129130
}
130131

131132
func TestDefaultCacheRefresh(t *testing.T) {
133+
if runtime.GOOS == "darwin" {
134+
t.Skip("skipping on darwin")
135+
}
132136
type specDirs struct {
133137
etc map[string]string
134138
run map[string]string

0 commit comments

Comments
 (0)