Пример #1
0
func NewServiceBroker(name string, path string) ServiceBroker {
	b := ServiceBroker{}
	b.Path = path
	b.Name = name
	b.Service.Name = generator.RandomName()
	b.Service.ID = generator.RandomName()
	b.Plan.Name = generator.RandomName()
	b.Plan.ID = generator.RandomName()
	return b
}
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	. "github.com/vito/cmdtest/matchers"

	. "github.com/peterellisjones/cf-acceptance-tests/helpers"
	"github.com/peterellisjones/cf-acceptance-tests/services/helpers"
	. "github.com/peterellisjones/cf-test-helpers/cf"
	"github.com/peterellisjones/cf-test-helpers/generator"
)

var _ = Describe("Service Broker Lifecycle", func() {
	var broker helpers.ServiceBroker

	BeforeEach(func() {
		helpers.LoginAsAdmin()
		broker = helpers.NewServiceBroker(generator.RandomName(), NewAssets().ServiceBroker)
		broker.Push()
		broker.Configure()
	})

	AfterEach(func() {
		helpers.LoginAsUser()
	})

	It("confirms correct behavior in the lifecycle of a service broker", func() {
		defer helpers.Recover() // Catches panic thrown by Require expectations

		// Adding the service broker
		helpers.Require(Cf("create-service-broker", broker.Name, "username", "password", AppUri(broker.Name, "", LoadConfig().AppsDomain))).To(ExitWithTimeout(0, 10*time.Second))
		Expect(Cf("service-brokers")).To(Say(broker.Name))
	. "github.com/onsi/gomega"
	. "github.com/vito/cmdtest/matchers"

	. "github.com/peterellisjones/cf-acceptance-tests/helpers"
	"github.com/peterellisjones/cf-acceptance-tests/services/helpers"
	. "github.com/peterellisjones/cf-test-helpers/cf"
	"github.com/peterellisjones/cf-test-helpers/generator"
)

var _ = Describe("Purging service offerings", func() {
	var broker helpers.ServiceBroker

	BeforeEach(func() {
		helpers.LoginAsAdmin()

		broker = helpers.NewServiceBroker(generator.RandomName(), NewAssets().ServiceBroker)
		broker.Push()
		broker.Configure()
		broker.Create(LoadConfig().AppsDomain)
		broker.PublicizePlans()
	})

	AfterEach(func() {
		broker.Destroy()
		helpers.LoginAsUser()
	})

	It("removes all instances and plans of the service, then removes the service offering", func() {
		defer helpers.Recover() // Catches panic thrown by Require expectations

		instanceName := "purge-offering-instance"