From 1328be7c299417aa8c8740ac4901a978724afa9b Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 3 Oct 2013 14:46:07 +0000 Subject: [PATCH] Add test --- runtime_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/runtime_test.go b/runtime_test.go index f4f5d5af1e..09056aafd1 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -203,6 +203,29 @@ func TestRuntimeCreate(t *testing.T) { if err == nil { t.Fatal("Builder.Create should throw an error when Cmd is empty") } + + config := &Config{ + Image: GetTestImage(runtime).ID, + Cmd: []string{"/bin/ls"}, + PortSpecs: []string{"80"}, + } + container, err = runtime.Create(config) + + image, err := runtime.Commit(container, "testrepo", "testtag", "", "", config) + if err != nil { + t.Error(err) + } + + _, err = runtime.Create( + &Config{ + Image: image.ID, + PortSpecs: []string{"80000:80"}, + }, + ) + if err == nil { + t.Fatal("Builder.Create should throw an error when PortSpecs is invalid") + } + } func TestDestroy(t *testing.T) {