当前位置: 首页>>代码示例>>Golang>>正文


Golang fakes.LinkFactory类代码示例

本文整理汇总了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{}
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:start_dns_server_test.go

示例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)
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:move_link_test.go

示例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)
		})
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:link_exists_test.go

示例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)
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:29,代码来源:get_hardware_address_test.go

示例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())
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:create_bridge_test.go

示例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,
		}
	})
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:30,代码来源:create_veth_test.go

示例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)
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:32,代码来源:sandbox_test.go

示例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())
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:create_dummy_test.go

示例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())
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:set_link_up_test.go

示例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)
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:create_vxlan_test.go

示例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")
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:30,代码来源:cleanup_sandbox_test.go

示例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())
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:30,代码来源:delete_link_test.go

示例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)
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:set_link_master_test.go


注:本文中的github.com/cloudfoundry-incubator/ducati-daemon/fakes.LinkFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。