コード例 #1
0
	"github.com/appc/cni/pkg/types"
	"github.com/cloudfoundry-incubator/ducati-daemon/cni"
	"github.com/cloudfoundry-incubator/ducati-daemon/container"
	"github.com/cloudfoundry-incubator/ducati-daemon/fakes"
	"github.com/cloudfoundry-incubator/ducati-daemon/models"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("CniAdd", func() {
	var (
		datastore     *fakes.Store
		ipamResult    *types.Result
		creator       *fakes.Creator
		controller    *cni.AddController
		ipAllocator   *fakes.IPAllocator
		networkMapper *fakes.NetworkMapper
		payload       models.CNIAddPayload
	)

	BeforeEach(func() {
		datastore = &fakes.Store{}
		creator = &fakes.Creator{}

		ipAllocator = &fakes.IPAllocator{}
		networkMapper = &fakes.NetworkMapper{}

		controller = &cni.AddController{
			Datastore:     datastore,
			Creator:       creator,
コード例 #2
0
import (
	"errors"

	"github.com/cloudfoundry-incubator/ducati-daemon/cni"
	"github.com/cloudfoundry-incubator/ducati-daemon/fakes"
	"github.com/cloudfoundry-incubator/ducati-daemon/models"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("CniDel", func() {
	var (
		datastore     *fakes.Store
		deletor       *fakes.Deletor
		controller    *cni.DelController
		ipAllocator   *fakes.IPAllocator
		networkMapper *fakes.NetworkMapper
		payload       models.CNIDelPayload
	)

	BeforeEach(func() {
		datastore = &fakes.Store{}
		deletor = &fakes.Deletor{}
		ipAllocator = &fakes.IPAllocator{}
		networkMapper = &fakes.NetworkMapper{}

		networkMapper.GetVNIReturns(42, nil)
		datastore.GetReturns(models.Container{
			NetworkID: "some-network-id",
		}, nil)