From 62cfad97cad3f1e2a5c1a3ec2dc3d0e35bef2eef Mon Sep 17 00:00:00 2001 From: l00397676 Date: Sun, 17 Jun 2018 20:42:04 +0800 Subject: [PATCH] specconv: add a test case to check null spec.Process Signed-off-by: l00397676 --- libcontainer/specconv/spec_linux_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libcontainer/specconv/spec_linux_test.go b/libcontainer/specconv/spec_linux_test.go index aca5ca5e..706df41c 100644 --- a/libcontainer/specconv/spec_linux_test.go +++ b/libcontainer/specconv/spec_linux_test.go @@ -585,3 +585,16 @@ func TestInitSystemdProps(t *testing.T) { } } } + +func TestNullProcess(t *testing.T) { + spec := Example() + spec.Process = nil + + _, err := CreateLibcontainerConfig(&CreateOpts{ + Spec: spec, + }) + + if err != nil { + t.Errorf("Null process should be forbidden") + } +}