Beispiel #1
0
func RabbitWithTag(tag string) (*RabbitMQ, error) {
	svc, err := env.ServiceWithTag(tag)
	if err != nil {
		return nil, err
	}
	return rabbitLift(svc)
}
Beispiel #2
0
func EurekaWithTag(tag string) (*eureka.Client, error) {
	svc, err := env.ServiceWithTag(tag)
	if err != nil {
		return nil, err
	}
	return eurekaLift(svc)
}
Beispiel #3
0
	"github.com/st3v/cfkit/env"
)

var _ = Describe(".ServiceWithTag", func() {
	BeforeEach(func() {
		os.Setenv("VCAP_SERVICES", vcapServices)
	})

	AfterEach(func() {
		os.Unsetenv("VCAP_SERVICES")
	})

	Context("when the service is defined", func() {
		It("does NOT return an error", func() {
			_, err := env.ServiceWithTag("service-tag-2")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns the correct service", func() {
			svc, _ := env.ServiceWithTag("service-tag-2")
			Expect(svc.Name).To(Equal("service-name-2"))
			Expect(svc.Label).To(Equal("service-label"))
			Expect(svc.Plan).To(Equal("service-plan-2"))
		})

		It("is case-insensitive", func() {
			_, err := env.ServiceWithTag("SERVICE-TAG-2")
			Expect(err).ToNot(HaveOccurred())
		})
	})