mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
6bc05899aa
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
26 lines
474 B
Go
26 lines
474 B
Go
package ipallocator
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
)
|
|
|
|
func TestRegisterNetwork(t *testing.T) {
|
|
network := &net.IPNet{
|
|
IP: []byte{192, 168, 0, 1},
|
|
Mask: []byte{255, 255, 255, 0},
|
|
}
|
|
|
|
if err := RegisterNetwork(network); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
n := newIPNet(network)
|
|
if _, exists := allocatedIPs[n]; !exists {
|
|
t.Fatal("IPNet should exist in allocated IPs")
|
|
}
|
|
|
|
if _, exists := availableIPS[n]; !exists {
|
|
t.Fatal("IPNet should exist in available IPs")
|
|
}
|
|
}
|