本文整理匯總了Golang中github.com/cloudfoundry-incubator/ducati-daemon/fakes.LinkFactory類的典型用法代碼示例。如果您正苦於以下問題:Golang LinkFactory類的具體用法?Golang LinkFactory怎麽用?Golang LinkFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了LinkFactory類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"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{}
示例2:
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)
示例3:
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)
})
示例4:
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)
示例5:
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())
示例6:
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,
}
})
示例7:
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)
示例8:
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())
示例9:
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())
示例10:
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)
示例11:
"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")
示例12:
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())
示例13:
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)