})

			It("returns the error", func() {
				err := missWatcher.StartMonitor(ns, vxlanLinkName)
				Expect(err).To(MatchError("arp inserter failed: handle resolved: zuccini"))
			})

			It("subscriber does not get called", func() {
				missWatcher.StartMonitor(ns, vxlanLinkName)
				Consistently(sub.SubscribeCallCount).Should(Equal(0))
			})
		})

		It("locks and unlocks to protect the map", func() {
			missWatcher.StartMonitor(ns, vxlanLinkName)
			Expect(locker.LockCallCount()).To(Equal(1))
			Expect(locker.UnlockCallCount()).To(Equal(1))
		})

		Context("when subscribe returns an error", func() {
			It("returns the error", func() {
				sub.SubscribeReturns(errors.New("some subscribe error"))
				err := missWatcher.StartMonitor(ns, vxlanLinkName)
				Expect(err).To(MatchError("subscribe in some-namespace: some subscribe error"))
			})
		})
	})

	Describe("StopMonitor", func() {
		var complete chan struct{}
					},
					Gateway: net.ParseIP("192.168.2.1").To4(),
					Routes: []types.Route{{
						Dst: net.IPNet{
							IP:   net.ParseIP("192.168.0.0").To4(),
							Mask: net.CIDRMask(16, 32),
						},
					}},
				},
			}))
		})

		It("acquires and releases a lock when accessing stores collection", func() {
			allocator.AllocateIP("network-id", "container-id")

			Expect(storeLocker.LockCallCount()).To(Equal(1))
			Expect(storeLocker.UnlockCallCount()).To(Equal(1))
		})

		It("acquires and releases a lock when accessing the configs collection", func() {
			allocator.AllocateIP("network-id", "container-id")

			Expect(configLocker.LockCallCount()).To(Equal(1))
			Expect(configLocker.UnlockCallCount()).To(Equal(1))
		})

		Context("when a network configuration already exists", func() {
			It("does not create a new configuration", func() {
				allocator.AllocateIP("network-id", "container-id")
				allocator.AllocateIP("network-id", "container-id")