"github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Start DNS Server", func() { var ( ns *fakes.Namespace context *fakes.Context listenerFactory *fakes.ListenerFactory linkFactory *fakes.LinkFactory addressManager *fakes.AddressManager dnsServerFactory *fakes.DNSServerFactory returnedListener *net.UDPConn sandboxRepo *fakes.SandboxRepository sbox *fakes.Sandbox dnsServer *fakes.Runner startDNS commands.StartDNSServer ) BeforeEach(func() { listenerFactory = &fakes.ListenerFactory{} linkFactory = &fakes.LinkFactory{} addressManager = &fakes.AddressManager{} dnsServerFactory = &fakes.DNSServerFactory{} ns = &fakes.Namespace{}
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("MoveLink", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory sandboxRepository *fakes.SandboxRepository sbox *fakes.Sandbox moveLink commands.MoveLink ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) sandboxRepository = &fakes.SandboxRepository{} context.SandboxRepositoryReturns(sandboxRepository) sbox = &fakes.Sandbox{} sandboxRepository.GetReturns(sbox, nil)
package conditions_test import ( "github.com/cloudfoundry-incubator/ducati-daemon/executor/conditions" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("LinkExists", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory linkExists conditions.LinkExists ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) linkExists = conditions.LinkExists{ Name: "my-interface", } }) Context("when the link exists", func() { BeforeEach(func() { linkFactory.ExistsReturns(true) })
import ( "errors" "net" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("GetHardwareAddress", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory hwAddr net.HardwareAddr getHWAddress *commands.GetHardwareAddress ) BeforeEach(func() { var err error hwAddr, err = net.ParseMAC("FF:FF:FF:FF:FF:FF") Expect(err).NotTo(HaveOccurred()) linkFactory = &fakes.LinkFactory{} linkFactory.HardwareAddressReturns(hwAddr, nil) context = &fakes.Context{} context.LinkFactoryReturns(linkFactory)
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CreateBridge", func() { var ( linkFactory *fakes.LinkFactory context *fakes.Context createBridge commands.CreateBridge ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) createBridge = commands.CreateBridge{ Name: "my-bridge", } }) It("creates a bridge device", func() { err := createBridge.Execute(context) Expect(err).NotTo(HaveOccurred())
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CreateVeth", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory createVeth commands.CreateVeth ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) createVeth = commands.CreateVeth{ Name: "if-name", PeerName: "peer-if-name", MTU: 99, } })
import ( "errors" "os" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" "github.com/cloudfoundry-incubator/ducati-daemon/sandbox" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pivotal-golang/lager/lagertest" ) var _ = Describe("Sandbox", func() { var ( sb sandbox.Sandbox logger *lagertest.TestLogger sbNamespace *fakes.Namespace invoker *fakes.Invoker watcher *fakes.MissWatcher linkFactory *fakes.LinkFactory ) BeforeEach(func() { logger = lagertest.NewTestLogger("test") invoker = &fakes.Invoker{} watcher = &fakes.MissWatcher{} linkFactory = &fakes.LinkFactory{} sbNamespace = &fakes.Namespace{} sbNamespace.ExecuteStub = func(callback func(*os.File) error) error { return callback(nil) } sb = sandbox.New(logger, sbNamespace, invoker, linkFactory, watcher)
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CreateDummy", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory createDummy commands.CreateDummy ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) createDummy = commands.CreateDummy{ Name: "my-dummy", } }) It("uses the factory to create the adapter", func() { err := createDummy.Execute(context) Expect(err).NotTo(HaveOccurred())
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("SetLinkUp", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory setLinkUp commands.SetLinkUp ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) setLinkUp = commands.SetLinkUp{ LinkName: "link-name", } }) It("sets the link up", func() { err := setLinkUp.Execute(context) Expect(err).NotTo(HaveOccurred())
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CreateVxlan", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory createVxlan commands.CreateVxlan ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) createVxlan = commands.CreateVxlan{ Name: "my-vxlan", VNI: 99, } }) It("uses the factory to create the adapter", func() { err := createVxlan.Execute(context)
"github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" "github.com/cloudfoundry-incubator/ducati-daemon/sandbox" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" "github.com/pivotal-golang/lager/lagertest" ) var _ = Describe("CleanupSandbox", func() { var ( context *fakes.Context logger *lagertest.TestLogger sbox *fakes.Sandbox sandboxNS *fakes.Namespace linkFactory *fakes.LinkFactory cleanupSandboxCommand commands.CleanupSandbox missWatcher *fakes.MissWatcher namespaceRepository *fakes.Repository sandboxRepo *fakes.SandboxRepository ) BeforeEach(func() { context = &fakes.Context{} logger = lagertest.NewTestLogger("test") context.LoggerReturns(logger) sandboxNS = &fakes.Namespace{} sandboxNS.NameReturns("sandbox-name")
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("DeleteLink", func() { var ( context *fakes.Context deleteLinkCommand commands.DeleteLink linkFactory *fakes.LinkFactory ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) deleteLinkCommand = commands.DeleteLink{LinkName: "some-link-name"} }) It("calls Delete method on context.LinkFactory", func() { err := deleteLinkCommand.Execute(context) Expect(err).NotTo(HaveOccurred())
package commands_test import ( "errors" "github.com/cloudfoundry-incubator/ducati-daemon/executor/commands" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("SetLinkMaster", func() { var ( context *fakes.Context linkFactory *fakes.LinkFactory setLinkMaster commands.SetLinkMaster ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) setLinkMaster = commands.SetLinkMaster{ Master: "master-dev", Slave: "slave-dev", } }) It("assigns a master to the slave", func() { err := setLinkMaster.Execute(context)