Improve libcontainer namespace and cap format
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
bbc3c913a9
commit
412c081a9b
9 changed files with 128 additions and 206 deletions
|
@ -15,7 +15,7 @@ func TestContainerJsonFormat(t *testing.T) {
|
|||
|
||||
var container *Container
|
||||
if err := json.NewDecoder(f).Decode(&container); err != nil {
|
||||
t.Fatal("failed to decode container config")
|
||||
t.Fatalf("failed to decode container config: %s", err)
|
||||
}
|
||||
if container.Hostname != "koye" {
|
||||
t.Log("hostname is not set")
|
||||
|
@ -27,32 +27,32 @@ func TestContainerJsonFormat(t *testing.T) {
|
|||
t.Fail()
|
||||
}
|
||||
|
||||
if !container.Namespaces.Contains("NEWNET") {
|
||||
if !container.Namespaces["NEWNET"] {
|
||||
t.Log("namespaces should contain NEWNET")
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if container.Namespaces.Contains("NEWUSER") {
|
||||
if container.Namespaces["NEWUSER"] {
|
||||
t.Log("namespaces should not contain NEWUSER")
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if !container.CapabilitiesMask.Contains("SYS_ADMIN") {
|
||||
if _, exists := container.CapabilitiesMask["SYS_ADMIN"]; !exists {
|
||||
t.Log("capabilities mask should contain SYS_ADMIN")
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if container.CapabilitiesMask.Get("SYS_ADMIN").Enabled {
|
||||
if container.CapabilitiesMask["SYS_ADMIN"] {
|
||||
t.Log("SYS_ADMIN should not be enabled in capabilities mask")
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if !container.CapabilitiesMask.Get("MKNOD").Enabled {
|
||||
if !container.CapabilitiesMask["MKNOD"] {
|
||||
t.Log("MKNOD should be enabled in capabilities mask")
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if container.CapabilitiesMask.Contains("SYS_CHROOT") {
|
||||
if container.CapabilitiesMask["SYS_CHROOT"] {
|
||||
t.Log("capabilities mask should not contain SYS_CHROOT")
|
||||
t.Fail()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue