mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add test
This commit is contained in:
parent
5bd0437eed
commit
1328be7c29
1 changed files with 23 additions and 0 deletions
|
@ -203,6 +203,29 @@ func TestRuntimeCreate(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("Builder.Create should throw an error when Cmd is empty")
|
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) {
|
func TestDestroy(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue