예제 #1
0
			})

			It("returns errors from fetching the ActualLRPs", func() {
				fakeReceptorClient.ActualLRPsReturns(nil, errors.New("Receptor is Running."))

				_, err := appExaminer.ListCells()
				Expect(err).To(MatchError("Receptor is Running."))
			})

		})
	})

	Describe("AppStatus", func() {
		var (
			getDesiredLRPResponse           receptor.DesiredLRPResponse
			actualLRPsByProcessGuidResponse []receptor.ActualLRPResponse
			containerMetrics                []*events.ContainerMetric
		)

		buildContainerMetric := func(applicationId string, instanceIndex int32, cpuPercentage float64, memoryBytes, diskBytes uint64) *events.ContainerMetric {
			return &events.ContainerMetric{
				ApplicationId: &applicationId,
				InstanceIndex: &instanceIndex,
				CpuPercentage: &cpuPercentage,
				MemoryBytes:   &memoryBytes,
				DiskBytes:     &diskBytes,
			}
		}

		Context("When receptor successfully responds to all requests", func() {
			BeforeEach(func() {
	"github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh"
	"github.com/cloudfoundry-incubator/receptor"
	"github.com/cloudfoundry-incubator/receptor/fake_receptor"
	"github.com/pivotal-golang/lager/lagertest"
	"golang.org/x/crypto/ssh"

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

var _ = Describe("DiegoProxyAuthenticator", func() {
	var (
		receptorClient     *fake_receptor.FakeClient
		expectedRoute      routes.SSHRoute
		desiredLRPResponse receptor.DesiredLRPResponse
		actualLrpResponse  receptor.ActualLRPResponse
		authenticator      *authenticators.DiegoProxyAuthenticator
		logger             *lagertest.TestLogger
		receptorCreds      []byte
		metadata           *fake_ssh.FakeConnMetadata
	)

	BeforeEach(func() {
		receptorClient = new(fake_receptor.FakeClient)

		expectedRoute = routes.SSHRoute{
			ContainerPort:   1111,
			PrivateKey:      "pem-encoded-key",
			HostFingerprint: "host-fingerprint",
			User:            "******",
			Password:        "******",
		}