Exemplo n.º 1
0
package broker_test

import (
	"github.com/cloudfoundry-community/cf-subway/broker"
	"github.com/frodenas/brokerapi"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Service broker", func() {
	var subway *broker.Broker

	BeforeEach(func() {
		subway = broker.NewBroker()
		subway.BackendCatalog = brokerapi.CatalogResponse{
			Services: []brokerapi.Service{
				{
					Plans: []brokerapi.ServicePlan{{ID: "plan-uuid"}},
				},
			},
		}
		subway.BackendBrokers = []*broker.BackendBroker{{URI: "TEST-SUCCESS"}}
	})

	Describe(".Provision", func() {
		Context("when the plan is recognized", func() {
			It("creates an instance if first backend ok", func() {
				subway.BackendBrokers = []*broker.BackendBroker{{URI: "TEST-SUCCESS"}}
				_, _, err := subway.Provision("some-id", brokerapi.ProvisionDetails{PlanID: "plan-uuid"}, false)
				Ω(err).ToNot(HaveOccurred())
			})
Exemplo n.º 2
0
func runBroker(c *cli.Context) {
	subway := broker.NewBroker()
	subway.LoadBackendBrokersFromEnv()

	subway.Run()
}