})
		})
	})

	Describe("Teardown", func() {
		It("tears down the sandbox", func() {
			err := sb.Teardown()
			Expect(err).NotTo(HaveOccurred())
		})

		It("stops the arp miss monitor", func() {
			err := sb.Teardown()
			Expect(err).NotTo(HaveOccurred())

			Expect(watcher.StopMonitorCallCount()).To(Equal(1))
			targetNS := watcher.StopMonitorArgsForCall(0)
			Expect(targetNS).To(Equal(sbNamespace))
		})

		Context("when the DNS server has been launched", func() {
			var process *fakes.Process

			BeforeEach(func() {
				process = &fakes.Process{}
				invoker.InvokeReturns(process)

				runner := &fakes.Runner{}
				err := sb.LaunchDNS(runner)
				Expect(err).NotTo(HaveOccurred())
			})
		It("does not close the ready channel", func() {
			Consistently(process.Ready()).ShouldNot(BeClosed())
		})
	})

	It("calls StopMonitor when signaled", func() {
		Eventually(process.Ready()).Should(BeClosed())

		errCh := process.Wait()
		Consistently(errCh).ShouldNot(Receive())

		process.Signal(os.Kill)
		Eventually(missWatcher.StopMonitorCallCount).Should(Equal(1))
		Eventually(errCh).Should(Receive(BeNil()))

		namespace := missWatcher.StopMonitorArgsForCall(0)
		Expect(namespace).To(Equal(ns))
	})

	Context("when StopMonitor fails", func() {
		BeforeEach(func() {
			missWatcher.StopMonitorReturns(errors.New("kiwi"))
		})

		It("returns a meaningful error", func() {
			errCh := process.Wait()
			process.Signal(os.Kill)

			Eventually(errCh).Should(Receive(MatchError("stop monitor: kiwi")))
		})
	})