1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/networkdriver/portallocator/allocator_test.go
Michael Crosby 6bc05899aa Finish implementation and begin working on tests
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-01-22 18:05:20 -08:00

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")
}
}