From 58d04c903ac763f07d1b4e1d98ba0a51aa965185 Mon Sep 17 00:00:00 2001 From: Zou Rui <21751189@zju.edu.cn> Date: Mon, 2 Apr 2018 17:43:49 +0800 Subject: [PATCH] bugfix: change container create output Signed-off-by: Zou Rui <21751189@zju.edu.cn> --- cli/create.go | 4 ++-- test/cli_create_test.go | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cli/create.go b/cli/create.go index b7c1071f2..ab5de5d1a 100644 --- a/cli/create.go +++ b/cli/create.go @@ -68,12 +68,12 @@ func (cc *CreateCommand) runCreate(args []string) error { if len(result.Warnings) != 0 { fmt.Printf("WARNING: %s \n", strings.Join(result.Warnings, "\n")) } - fmt.Printf("container ID: %s, name: %s \n", result.ID, result.Name) + fmt.Printf(result.ID) return nil } // createExample shows examples in create command, and is used in auto-generated cli docs. func createExample() string { return `$ pouch create --name foo busybox:latest -container ID: e1d541722d68dc5d133cca9e7bd8fd9338603e1763096c8e853522b60d11f7b9, name: foo` +e1d541722d68dc5d133cca9e7bd8fd9338603e1763096c8e853522b60d11f7b9` } diff --git a/test/cli_create_test.go b/test/cli_create_test.go index 66e94a2bc..e1f37ca68 100644 --- a/test/cli_create_test.go +++ b/test/cli_create_test.go @@ -11,6 +11,7 @@ import ( "github.com/go-check/check" "github.com/gotestyourself/gotestyourself/icmd" + "github.com/stretchr/testify/assert" ) // PouchCreateSuite is the test suite for create CLI. @@ -39,9 +40,6 @@ func (suite *PouchCreateSuite) TestCreateName(c *check.C) { res := command.PouchRun("create", "--name", name, busyboxImage) res.Assert(c, icmd.Success) - if out := res.Combined(); !strings.Contains(out, name) { - c.Fatalf("unexpected output %s expected %s\n", out, name) - } defer DelContainerForceMultyTime(c, name) } @@ -57,9 +55,7 @@ func (suite *PouchCreateSuite) TestCreateNameByImageID(c *check.C) { res = command.PouchRun("create", "--name", name, imageID) res.Assert(c, icmd.Success) - if out := res.Combined(); !strings.Contains(out, name) { - c.Fatalf("unexpected output %s expected %s\n", out, name) - } + assert.Equal(c, len(res.Combined()), 64) DelContainerForceMultyTime(c, name) }