"github.com/cloudfoundry-incubator/ducati-daemon/fakes"
	"github.com/cloudfoundry-incubator/ducati-daemon/lib/namespace"
	"github.com/cloudfoundry-incubator/ducati-daemon/watcher"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Watcher", func() {
	var (
		logger        *lagertest.TestLogger
		locker        *fakes.Locker
		sub           *fakes.Subscriber
		ns            *fakes.Namespace
		vxlanLinkName string
		resolver      *fakes.Resolver
		missWatcher   watcher.MissWatcher
		arpInserter   *fakes.ARPInserter
	)

	BeforeEach(func() {
		sub = &fakes.Subscriber{}
		logger = lagertest.NewTestLogger("test")
		locker = &fakes.Locker{}

		ns = &fakes.Namespace{}
		ns.MarshalJSONReturns([]byte("{}"), nil)

		vxlanLinkName = "some-vxlan-name"
		resolver = &fakes.Resolver{}
	"errors"
	"net"

	"github.com/appc/cni/pkg/types"
	"github.com/cloudfoundry-incubator/ducati-daemon/fakes"
	"github.com/cloudfoundry-incubator/ducati-daemon/ipam"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("IP Address Management", func() {
	var (
		store         *fakes.AllocatorStore
		storeFactory  *fakes.StoreFactory
		storeLocker   *fakes.Locker
		configFactory *fakes.ConfigFactory
		configLocker  *fakes.Locker
		allocator     ipam.IPAllocator
		allocated     map[string]struct{}
		config        types.IPConfig
	)

	BeforeEach(func() {
		store = &fakes.AllocatorStore{}
		storeFactory = &fakes.StoreFactory{}
		storeLocker = &fakes.Locker{}

		configFactory = &fakes.ConfigFactory{}
		configLocker = &fakes.Locker{}

		config = types.IPConfig{
			IP: net.IPNet{