Merge pull request #1925 from Ace-Tang/fix_dup_ns
test: fix TestDupNamespaces fail to test dup-ns error
This commit is contained in:
commit
bd420b59f1
|
@ -4,6 +4,7 @@ package specconv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
|
@ -395,6 +396,9 @@ func TestSpecconvExampleValidate(t *testing.T) {
|
||||||
|
|
||||||
func TestDupNamespaces(t *testing.T) {
|
func TestDupNamespaces(t *testing.T) {
|
||||||
spec := &specs.Spec{
|
spec := &specs.Spec{
|
||||||
|
Root: &specs.Root{
|
||||||
|
Path: "rootfs",
|
||||||
|
},
|
||||||
Linux: &specs.Linux{
|
Linux: &specs.Linux{
|
||||||
Namespaces: []specs.LinuxNamespace{
|
Namespaces: []specs.LinuxNamespace{
|
||||||
{
|
{
|
||||||
|
@ -412,7 +416,7 @@ func TestDupNamespaces(t *testing.T) {
|
||||||
Spec: spec,
|
Spec: spec,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err == nil {
|
if !strings.Contains(err.Error(), "malformed spec file: duplicated ns") {
|
||||||
t.Errorf("Duplicated namespaces should be forbidden")
|
t.Errorf("Duplicated namespaces should be forbidden")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue