}, WaitUntilConnectableFunc: func(*net.TCPAddr, time.Duration) error { return connectionTimeoutErr }, } }) itStartsARedisProcess := func(executablePath string) { Ω(commandRunner.Commands).To(Equal([]string{ fmt.Sprintf("%s configFilePath --pidfile pidFilePath --dir instanceDataDir --logfile logFilePath", executablePath), })) } Describe("StartAndWaitUntilReady", func() { It("runs the right command to start redis", func() { processController.StartAndWaitUntilReady(instance, "configFilePath", "instanceDataDir", "pidFilePath", "logFilePath", time.Second*1) itStartsARedisProcess("redis-server") }) It("returns no error", func() { err := processController.StartAndWaitUntilReady(instance, "", "", "", "", time.Second*1) Ω(err).NotTo(HaveOccurred()) }) Context("when the redis process fails to start", func() { BeforeEach(func() { connectionTimeoutErr = errors.New("oops") }) It("returns the same error that the WaitUntilConnectableFunc returns", func() { err := processController.StartAndWaitUntilReady(instance, "", "", "", "", time.Second*1)