mirror of https://github.com/docker/docs.git
Merge pull request #4958 from crosbymichael/update-port-tests
Update test to reallocate port
This commit is contained in:
commit
79c0ca81fc
|
@ -118,6 +118,19 @@ func TestAllocateAllPorts(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// release a port in the middle and ensure we get another tcp port
|
||||||
|
port := BeginPortRange + 5
|
||||||
|
if err := ReleasePort(defaultIP, "tcp", port); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
newPort, err := RequestPort(defaultIP, "tcp", 0)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if newPort != port {
|
||||||
|
t.Fatalf("Expected port %d got %d", port, newPort)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkAllocatePorts(b *testing.B) {
|
func BenchmarkAllocatePorts(b *testing.B) {
|
||||||
|
|
Loading…
Reference in New Issue