. "github.com/onsi/gomega"
	"github.com/pivotal-cf/cf-redis-broker/integration"
	"github.com/pivotal-cf/cf-redis-broker/integration/helpers"

	"github.com/pivotal-cf/cf-redis-broker/availability"
)

var _ = Describe("restarting processes", func() {
	Context("when an instance is provisioned, bound, and has data written to it", func() {
		var instanceID string
		var host string
		var port uint
		var password string
		var client redisclient.Conn

		processMonitorPath := helpers.BuildExecutable("github.com/pivotal-cf/cf-redis-broker/cmd/processmonitor")

		configCommand := "CONFIG"

		BeforeEach(func() {
			monitorSession = integration.LaunchProcessWithBrokerConfig(processMonitorPath, "broker.yml")

			instanceID = uuid.NewRandom().String()
			statusCode, _ := brokerClient.ProvisionInstance(instanceID, "shared")
			Ω(statusCode).To(Equal(201))

			bindingID := uuid.NewRandom().String()
			statusCode, body := brokerClient.BindInstance(instanceID, bindingID)
			Ω(statusCode).To(Equal(201))

			var parsedJSON map[string]interface{}
var (
	backupExecutablePath string
	awsCliPath           = "aws"
	redisRunner          *integration.RedisRunner
	brokerHost           = "127.0.0.1"
	brokerPort           = 8080
)

func TestBackupintegration(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Backup Integration Suite")
}

var _ = BeforeSuite(func() {
	backupExecutablePath = helpers.BuildExecutable("github.com/pivotal-cf/cf-redis-broker/cmd/backup")

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Header().Add("Content-Type", "application/json")
		fmt.Fprintf(w, "{\"instance_id\": \"this_is_an_instance_id\"}")
	})

	go func() {
		http.ListenAndServe(fmt.Sprintf(":%v", brokerPort), nil)
	}()
})

var _ = AfterSuite(func() {
	gexec.CleanupBuildArtifacts()
})
package restoreintegration_test

import (
	. "github.com/onsi/ginkgo"
	"github.com/onsi/ginkgo/reporters"
	. "github.com/onsi/gomega"
	"github.com/pivotal-cf/cf-redis-broker/integration/helpers"

	"testing"
)

func TestRestore(t *testing.T) {
	RegisterFailHandler(Fail)
	junitReporter := reporters.NewJUnitReporter("junit_restoreintegration.xml")
	RunSpecsWithDefaultAndCustomReporters(t, "Restore Integration Suite", []Reporter{junitReporter})
}

var restoreExecutablePath string

var _ = BeforeSuite(func() {
	if helpers.ServiceAvailable(6379) {
		panic("something is already using the dedicated redis port!")
	}
	restoreExecutablePath = helpers.BuildExecutable("github.com/pivotal-cf/cf-redis-broker/cmd/restore")
})
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
	"github.com/pborman/uuid"
	"github.com/pivotal-cf/cf-redis-broker/integration"
	"github.com/pivotal-cf/cf-redis-broker/integration/helpers"
)

var sourcePath = "github.com/pivotal-cf/cf-redis-broker/cmd/processmonitor"

var _ = Describe("processmonitor cmd", func() {
	Describe("Log output", func() {
		var monitorSession *gexec.Session
		processMonitorPath := helpers.BuildExecutable(sourcePath)

		Context("When there are no Redis instances provisioned", func() {
			BeforeEach(func() {
				monitorSession = integration.LaunchProcessWithBrokerConfig(processMonitorPath, "broker.yml")
			})

			AfterEach(func() {
				helpers.KillProcess(monitorSession)
			})

			It("logs 0 instances found", func() {
				Eventually(monitorSession.Buffer()).Should(gbytes.Say("0 shared Redis instances found"))
			})
		})
Esempio n. 5
0
func BuildBroker() string {
	return helpers.BuildExecutable("github.com/pivotal-cf/cf-redis-broker/cmd/broker")
}