Example #1
0
func New() *FakeClient {
	connection := fake_connection.New()

	return &FakeClient{
		Connection: connection,

		Client: client.New(&FakeConnectionProvider{
			Connection: connection,
		}),
	}
}
Example #2
0
	. "github.com/onsi/gomega"

	. "github.com/cloudfoundry-incubator/garden/client"
	"github.com/cloudfoundry-incubator/garden/client/connection"
	"github.com/cloudfoundry-incubator/garden/client/connection/fake_connection"
	"github.com/cloudfoundry-incubator/garden/warden"
)

var _ = Describe("Client", func() {
	var connectionProvider ConnectionProvider
	var client Client

	var fakeConnection *fake_connection.FakeConnection

	BeforeEach(func() {
		fakeConnection = fake_connection.New()

		connectionProvider = &FakeConnectionProvider{
			Connection: fakeConnection,
		}
	})

	JustBeforeEach(func() {
		client = New(connectionProvider)
	})

	Describe("when the connection is broken", func() {
		var reconnectedConnection *fake_connection.FakeConnection

		BeforeEach(func() {
			reconnectedConnection = fake_connection.New()
Example #3
0
	"strings"

	. "github.com/cloudfoundry-incubator/garden/client"
	"github.com/cloudfoundry-incubator/garden/client/connection"
	"github.com/cloudfoundry-incubator/garden/client/connection/fake_connection"
	"github.com/cloudfoundry-incubator/garden/warden"
)

var _ = Describe("Container", func() {
	var connectionProvider ConnectionProvider
	var container warden.Container

	var fakeConnection *fake_connection.FakeConnection

	BeforeEach(func() {
		fakeConnection = fake_connection.New()

		connectionProvider = &FakeConnectionProvider{
			Connection: fakeConnection,
		}
	})

	JustBeforeEach(func() {
		var err error

		client := New(connectionProvider)

		fakeConnection.WhenCreating = func(warden.ContainerSpec) (string, error) {
			return "some-handle", nil
		}