From 95d1aa1886e4c95136c1fab52af37642568a1135 Mon Sep 17 00:00:00 2001 From: Ace-Tang Date: Tue, 6 Nov 2018 11:34:33 +0800 Subject: [PATCH] test: fix TestDupNamespaces add Root in created spec, or error message is 'Root must be specified' Signed-off-by: Ace-Tang --- libcontainer/specconv/spec_linux_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libcontainer/specconv/spec_linux_test.go b/libcontainer/specconv/spec_linux_test.go index 96a8480f..50c620cb 100644 --- a/libcontainer/specconv/spec_linux_test.go +++ b/libcontainer/specconv/spec_linux_test.go @@ -4,6 +4,7 @@ package specconv import ( "os" + "strings" "testing" "github.com/opencontainers/runc/libcontainer/configs" @@ -395,6 +396,9 @@ func TestSpecconvExampleValidate(t *testing.T) { func TestDupNamespaces(t *testing.T) { spec := &specs.Spec{ + Root: &specs.Root{ + Path: "rootfs", + }, Linux: &specs.Linux{ Namespaces: []specs.LinuxNamespace{ { @@ -412,7 +416,7 @@ func TestDupNamespaces(t *testing.T) { Spec: spec, }) - if err == nil { + if !strings.Contains(err.Error(), "malformed spec file: duplicated ns") { t.Errorf("Duplicated namespaces should be forbidden") } }