| 1 |
package userns |
| 2 |
|
| 3 |
import "testing" |
| 4 |
|
| 5 |
func TestUIDMapInUserNS(t *testing.T) { |
| 6 |
cases := []struct { |
| 7 |
s string |
| 8 |
expected bool |
| 9 |
}{ |
| 10 |
{ |
| 11 |
s: " 0 0 4294967295\n", |
| 12 |
expected: false, |
| 13 |
}, |
| 14 |
{ |
| 15 |
s: " 0 0 1\n", |
| 16 |
expected: true, |
| 17 |
}, |
| 18 |
{ |
| 19 |
s: " 0 1001 1\n 1 231072 65536\n", |
| 20 |
expected: true, |
| 21 |
}, |
| 22 |
{ |
| 23 |
|
| 24 |
s: "", |
| 25 |
expected: true, |
| 26 |
}, |
| 27 |
} |
| 28 |
for _, c := range cases { |
| 29 |
actual := uidMapInUserNS(c.s) |
| 30 |
if c.expected != actual { |
| 31 |
t.Fatalf("expected %v, got %v for %q", c.expected, actual, c.s) |
| 32 |
} |
| 33 |
} |
| 34 |
} |