libnetwork/portallocator: format code with gofumpt
Formatting the code with https://github.com/mvdan/gofumpt Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
6187ada21f
commit
801cd50744
1 changed files with 7 additions and 7 deletions
|
@ -246,13 +246,13 @@ func TestPortAllocationWithCustomRange(t *testing.T) {
|
|||
start, end := 8081, 8082
|
||||
specificPort := 8000
|
||||
|
||||
//get an ephemeral port.
|
||||
// get an ephemeral port.
|
||||
port1, err := p.RequestPortInRange(defaultIP, "tcp", 0, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
//request invalid ranges
|
||||
// request invalid ranges
|
||||
if _, err := p.RequestPortInRange(defaultIP, "tcp", 0, end); err == nil {
|
||||
t.Fatalf("Expected error for invalid range %d-%d", 0, end)
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ func TestPortAllocationWithCustomRange(t *testing.T) {
|
|||
t.Fatalf("Expected error for invalid range %d-%d", 0, end)
|
||||
}
|
||||
|
||||
//request a single port
|
||||
// request a single port
|
||||
port, err := p.RequestPortInRange(defaultIP, "tcp", specificPort, specificPort)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -272,7 +272,7 @@ func TestPortAllocationWithCustomRange(t *testing.T) {
|
|||
t.Fatalf("Expected port %d, got %d", specificPort, port)
|
||||
}
|
||||
|
||||
//get a port from the range
|
||||
// get a port from the range
|
||||
port2, err := p.RequestPortInRange(defaultIP, "tcp", start, end)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -280,7 +280,7 @@ func TestPortAllocationWithCustomRange(t *testing.T) {
|
|||
if port2 < start || port2 > end {
|
||||
t.Fatalf("Expected a port between %d and %d, got %d", start, end, port2)
|
||||
}
|
||||
//get another ephemeral port (should be > port1)
|
||||
// get another ephemeral port (should be > port1)
|
||||
port3, err := p.RequestPortInRange(defaultIP, "tcp", 0, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -288,7 +288,7 @@ func TestPortAllocationWithCustomRange(t *testing.T) {
|
|||
if port3 < port1 {
|
||||
t.Fatalf("Expected new port > %d in the ephemeral range, got %d", port1, port3)
|
||||
}
|
||||
//get another (and in this case the only other) port from the range
|
||||
// get another (and in this case the only other) port from the range
|
||||
port4, err := p.RequestPortInRange(defaultIP, "tcp", start, end)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -299,7 +299,7 @@ func TestPortAllocationWithCustomRange(t *testing.T) {
|
|||
if port4 == port2 {
|
||||
t.Fatal("Allocated the same port from a custom range")
|
||||
}
|
||||
//request 3rd port from the range of 2
|
||||
// request 3rd port from the range of 2
|
||||
if _, err := p.RequestPortInRange(defaultIP, "tcp", start, end); err != ErrAllPortsAllocated {
|
||||
t.Fatalf("Expected error %s got %s", ErrAllPortsAllocated, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue