Example #1
0
	"github.com/cloudfoundry-incubator/guardian/kawasaki"
	"github.com/cloudfoundry-incubator/guardian/kawasaki/configure"
	"github.com/cloudfoundry-incubator/guardian/kawasaki/devices/fakedevices"
	"github.com/pivotal-golang/lager/lagertest"

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

var _ = Describe("Host", func() {
	var (
		vethCreator    *fakedevices.FaveVethCreator
		linkConfigurer *fakedevices.FakeLink
		bridger        *fakedevices.FakeBridge

		configurer *configure.Host

		config kawasaki.NetworkConfig
	)

	BeforeEach(func() {
		vethCreator = &fakedevices.FaveVethCreator{}
		linkConfigurer = &fakedevices.FakeLink{AddIPReturns: make(map[string]error)}
		bridger = &fakedevices.FakeBridge{}

		configurer = &configure.Host{Veth: vethCreator, Link: linkConfigurer, Bridge: bridger, Logger: lagertest.NewTestLogger("test")}

		config = kawasaki.NetworkConfig{}
	})
Example #2
0
	"errors"
	"net"

	"github.com/cloudfoundry-incubator/guardian/kawasaki"
	"github.com/cloudfoundry-incubator/guardian/kawasaki/configure"
	"github.com/cloudfoundry-incubator/guardian/kawasaki/devices/fakedevices"
	"github.com/pivotal-golang/lager/lagertest"

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

var _ = Describe("Container", func() {
	var (
		linkApplyr *fakedevices.FakeLink
		configurer *configure.Container
		config     kawasaki.NetworkConfig
	)

	BeforeEach(func() {
		linkApplyr = &fakedevices.FakeLink{AddIPReturns: make(map[string]error)}
		configurer = &configure.Container{
			Link:   linkApplyr,
			Logger: lagertest.NewTestLogger("test"),
		}
	})

	Context("when the loopback device does not exist", func() {
		var eth *net.Interface
		BeforeEach(func() {
			linkApplyr.InterfaceByNameFunc = func(name string) (*net.Interface, bool, error) {