. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var freePortsFound int

func fakeFreePortFinder() (int, error) {
	freePortsFound++
	return 8080, nil
}

var _ = Describe("Local Redis Creator", func() {

	var instanceID string
	var fakeProcessController *fakes.FakeProcessController
	var fakeLocalRepository *fakes.FakeLocalRepository
	var localInstanceCreator *redis.LocalInstanceCreator

	BeforeEach(func() {
		instanceID = uuid.NewRandom().String()
		fakeProcessController = &fakes.FakeProcessController{}

		fakeLocalRepository = &fakes.FakeLocalRepository{
			DeletedInstanceIds: []string{},
			CreatedInstances:   []*redis.Instance{},
			Instances:          []*redis.Instance{},
		}

		localInstanceCreator = &redis.LocalInstanceCreator{
			FindFreePort:            fakeFreePortFinder,
			ProcessController:       fakeProcessController,
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var freePortsFound int

func fakeFreePortFinder() (int, error) {
	freePortsFound++
	return 8080, nil
}

var _ = Describe("Local Redis Creator", func() {

	var instanceID string
	var fakeProcessController *fakes.FakeProcessController
	var fakeLocalRepository *fakes.FakeLocalRepository
	var localInstanceCreator *redis.LocalInstanceCreator

	BeforeEach(func() {
		instanceID = uuid.NewRandom().String()
		fakeProcessController = &fakes.FakeProcessController{}

		fakeLocalRepository = new(fakes.FakeLocalRepository)

		localInstanceCreator = &redis.LocalInstanceCreator{
			FindFreePort:            fakeFreePortFinder,
			ProcessController:       fakeProcessController,
			LocalInstanceRepository: fakeLocalRepository,
			RedisConfiguration: brokerconfig.ServiceConfiguration{
				ServiceInstanceLimit: 1,
			},