зеркало из https://github.com/microsoft/docker.git
add tests
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
Родитель
f411f8bfc5
Коммит
6cb16f1c31
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче