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

	. "bosh/platform/net"
	fakenet "bosh/platform/net/fakes"
	boshsettings "bosh/settings"
)

type NotIPNet struct{}

func (i NotIPNet) String() string  { return "" }
func (i NotIPNet) Network() string { return "" }

var _ = Describe("defaultNetworkResolver", func() {
	var (
		routesSearcher *fakenet.FakeRoutesSearcher
		resolver       DefaultNetworkResolver
	)

	BeforeEach(func() {
		routesSearcher = &fakenet.FakeRoutesSearcher{}
		resolver = NewDefaultNetworkResolver(routesSearcher, DefaultInterfaceToAddrsFunc)
	})

	Describe("Resolve", func() {
		It("returns a network associated with a first default gateway", func() {
			var ifaceName string

			if _, err := gonet.InterfaceByName("en0"); err == nil {
				ifaceName = "en0"
			} else if _, err := gonet.InterfaceByName("eth0"); err == nil {
				ifaceName = "eth0"
	"errors"
	gonet "net"

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

	. "bosh/platform/net"
	fakenet "bosh/platform/net/fakes"
	fakeip "bosh/platform/net/ip/fakes"
	boshsettings "bosh/settings"
)

var _ = Describe("defaultNetworkResolver", func() {
	var (
		routesSearcher *fakenet.FakeRoutesSearcher
		ipResolver     *fakeip.FakeIPResolver
		resolver       DefaultNetworkResolver
	)

	BeforeEach(func() {
		routesSearcher = &fakenet.FakeRoutesSearcher{}
		ipResolver = &fakeip.FakeIPResolver{}
		resolver = NewDefaultNetworkResolver(routesSearcher, ipResolver)
	})

	Describe("Resolve", func() {
		Context("when default route is found", func() {
			BeforeEach(func() {
				routesSearcher.SearchRoutesRoutes = []Route{
					Route{ // non-default route
						Destination:   "non-default-route1-dest",