"github.com/pivotal-cf/cf-redis-broker/instance/id"
	"github.com/pivotal-cf/cf-redis-broker/redisinstance"
	"github.com/pivotal-golang/lager"
	. "github.com/st3v/glager"
)

var _ = Describe("InstanceIDLocator", func() {
	Describe(".InstanceID", func() {
		var (
			brokerUsername     = "******"
			brokerPassword     = "******"
			clientUsername     string
			clientPassword     string
			server             *httptest.Server
			endpoint           string
			expectedURL        string
			idLocator          id.InstanceIDLocator
			expectedInstanceID = "some-instance-id"
			actualInstanceID   string
			instanceIDErr      error
			nodeIP             string
			log                *gbytes.Buffer
		)

		JustBeforeEach(func() {
			log = gbytes.NewBuffer()
			logger := lager.NewLogger("provider")
			logger.RegisterSink(lager.NewWriterSink(log, lager.DEBUG))

			idLocator = id.DedicatedInstanceIDLocator(endpoint, clientUsername, clientPassword, logger)
			actualInstanceID, instanceIDErr = idLocator.LocateID("", nodeIP)
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/pivotal-cf/cf-redis-broker/instance/id"
	"github.com/pivotal-golang/lager"
	. "github.com/st3v/glager"
)

var _ = Describe("SharedInstanceIDLocator", func() {

	Describe(".LocateID", func() {
		var (
			idLocator          id.InstanceIDLocator
			expectedInstanceID = "some-instance-id"
			actualInstanceID   string
			instanceIDErr      error
			redisConfigPath    string
			log                *gbytes.Buffer
		)

		BeforeEach(func() {
			log = gbytes.NewBuffer()
			logger := lager.NewLogger("provider")
			logger.RegisterSink(lager.NewWriterSink(log, lager.DEBUG))

			redisConfigPath = fmt.Sprintf("/var/vcap/store/redis/%s/redis.conf", expectedInstanceID)

			idLocator = id.SharedInstanceIDLocator(logger)
		})

		JustBeforeEach(func() {