aboutsummaryrefslogtreecommitdiff
path: root/pkg/sysinfo/sysinfo_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-06 17:27:50 -0800
committerGitHub <noreply@github.com>2019-01-06 17:27:50 -0800
commitb83b07cb4748f983c21b08b2ba015561cf664989 (patch)
tree049a5ed444ae3724ee1fd96f1d8d8f187f3d94c8 /pkg/sysinfo/sysinfo_test.go
parent49a474c4b747bb83e36cda335ac3ae1ce5ae9f0a (diff)
parent43686072d3ff559abb0aea865509ae85f8a301de (diff)
downloadpodman-b83b07cb4748f983c21b08b2ba015561cf664989.tar.gz
podman-b83b07cb4748f983c21b08b2ba015561cf664989.tar.bz2
podman-b83b07cb4748f983c21b08b2ba015561cf664989.zip
Merge pull request #2082 from rhatdan/runc
Update vendor of runc
Diffstat (limited to 'pkg/sysinfo/sysinfo_test.go')
-rw-r--r--pkg/sysinfo/sysinfo_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/sysinfo/sysinfo_test.go b/pkg/sysinfo/sysinfo_test.go
new file mode 100644
index 000000000..b61fbcf54
--- /dev/null
+++ b/pkg/sysinfo/sysinfo_test.go
@@ -0,0 +1,26 @@
+package sysinfo
+
+import "testing"
+
+func TestIsCpusetListAvailable(t *testing.T) {
+ cases := []struct {
+ provided string
+ available string
+ res bool
+ err bool
+ }{
+ {"1", "0-4", true, false},
+ {"01,3", "0-4", true, false},
+ {"", "0-7", true, false},
+ {"1--42", "0-7", false, true},
+ {"1-42", "00-1,8,,9", false, true},
+ {"1,41-42", "43,45", false, false},
+ {"0-3", "", false, false},
+ }
+ for _, c := range cases {
+ r, err := isCpusetListAvailable(c.provided, c.available)
+ if (c.err && err == nil) && r != c.res {
+ t.Fatalf("Expected pair: %v, %v for %s, %s. Got %v, %v instead", c.res, c.err, c.provided, c.available, (c.err && err == nil), r)
+ }
+ }
+}