Esempio n. 1
0
func BuildRedisClientFromConf(conf redisconf.Conf) redis.Conn {
	port, err := strconv.Atoi(conf.Get("port"))
	Ω(err).NotTo(HaveOccurred())

	password := conf.Get("requirepass")

	return BuildRedisClient(uint(port), "localhost", password)
}
func moveDataFor(propertyName, fileName, redisConfFilePath string) error {
	var fileContents []byte
	var redisConf redisconf.Conf
	var err error

	if redisConf, err = redisconf.Load(redisConfFilePath); err != nil {
		return err
	}
	if redisConf.Get(propertyName) != "" {
		os.Remove(fileName)
		return nil
	}

	if fileContents, err = ioutil.ReadFile(fileName); err != nil {
		return err
	}

	redisConf.Set(propertyName, string(fileContents))
	if err = redisConf.Save(redisConfFilePath); err != nil {
		return err
	}
	os.Remove(fileName)
	return nil
}
Esempio n. 3
0
	"github.com/onsi/gomega/gexec"
	"github.com/pivotal-cf/cf-redis-broker/integration/helpers"
	"github.com/pivotal-cf/cf-redis-broker/redisconf"

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

var redisSession *gexec.Session
var agentSession *gexec.Session

var _ = Describe("DELETE /", func() {

	var (
		redisConn         redis.Conn
		aofPath           string
		originalRedisConf redisconf.Conf
	)

	BeforeEach(func() {
		agentSession = startAgent()
		redisSession, aofPath = startRedisAndBlockUntilUp()

		var err error
		originalRedisConf, err = redisconf.Load(redisConfPath)
		Ω(err).ShouldNot(HaveOccurred())

		redisRestarted := make(chan bool)
		httpRequestReturned := make(chan bool)

		go checkRedisStopAndStart(redisRestarted)
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"strconv"

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

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

var _ = Describe("redisconf", func() {
	Describe("InitForDedicatedNode", func() {
		var conf redisconf.Conf

		BeforeEach(func() {
			path, err := filepath.Abs(path.Join("assets", "redis.conf"))
			Expect(err).ToNot(HaveOccurred())
			conf, err = redisconf.Load(path)
			Expect(err).ToNot(HaveOccurred())
			Expect(conf.Get("maxmemory")).To(BeEmpty())
			Expect(conf.Password()).To(BeEmpty())
		})

		It("sets the max memory parameter", func() {
			err := conf.InitForDedicatedNode()
			Expect(err).ToNot(HaveOccurred())

			maxmemory := conf.Get("maxmemory")