Add err checks for port allocator tests

Docker-DCO-1.1-Signed-off-by: Andy Kipp <andy@rstudio.com> (github: kippandrew)
This commit is contained in:
Andy Kipp 2014-03-18 13:29:24 -04:00
parent 73c416a20d
commit 555416fd02
1 changed files with 9 additions and 0 deletions

View File

@ -183,8 +183,17 @@ func TestPortAllocation(t *testing.T) {
}
port, err = RequestPort(ip, "tcp", 0)
if err != nil {
t.Fatal(err)
}
port2, err := RequestPort(ip, "tcp", port+1)
if err != nil {
t.Fatal(err)
}
port3, err := RequestPort(ip, "tcp", 0)
if err != nil {
t.Fatal(err)
}
if port3 == port2 {
t.Fatal("Requesting a dynamic port should never allocate a used port")
}