It("uses the DNS Server Factory to create a DNS server with the listener", func() { err := startDNS.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(dnsServerFactory.NewCallCount()).To(Equal(1)) packetConn, sboxNS := dnsServerFactory.NewArgsForCall(0) Expect(packetConn).To(BeIdenticalTo(returnedListener)) Expect(sboxNS).To(Equal(ns)) }) It("passes the dns server to the sandbox to be launched", func() { err := startDNS.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(sbox.LaunchDNSCallCount()).To(Equal(1)) Expect(sbox.LaunchDNSArgsForCall(0)).To(Equal(dnsServer)) }) Context("when parsing the listen address fails", func() { BeforeEach(func() { startDNS.ListenAddress = "some-bogus-address" }) It("returns a meaningful error", func() { err := startDNS.Execute(context) Expect(err).To(MatchError(MatchRegexp("resolve udp address:.*some-bogus-address"))) }) }) Context("when creating the dummy link fails", func() { BeforeEach(func() {