mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add tests
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
parent
f411f8bfc5
commit
6cb16f1c31
1 changed files with 26 additions and 0 deletions
|
@ -22,3 +22,29 @@ func TestParseLxcConfOpt(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNetHostname(t *testing.T) {
|
||||
if _, _, _, err := Parse([]string{"-h=name", "img", "cmd"}, nil); err != nil {
|
||||
t.Fatal("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
if _, _, _, err := Parse([]string{"--net=host", "img", "cmd"}, nil); err != nil {
|
||||
t.Fatal("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
if _, _, _, err := Parse([]string{"-h=name", "--net=bridge", "img", "cmd"}, nil); err != nil {
|
||||
t.Fatal("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
if _, _, _, err := Parse([]string{"-h=name", "--net=none", "img", "cmd"}, nil); err != nil {
|
||||
t.Fatal("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
if _, _, _, err := Parse([]string{"-h=name", "--net=host", "img", "cmd"}, nil); err != ErrConflictNetworkHostname {
|
||||
t.Fatal("Expected error ErrConflictNetworkHostname, got: %s", err)
|
||||
}
|
||||
|
||||
if _, _, _, err := Parse([]string{"-h=name", "--net=container:other", "img", "cmd"}, nil); err != ErrConflictNetworkHostname {
|
||||
t.Fatal("Expected error ErrConflictNetworkHostname, got: %s", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue