instance := redis.Instance{ ID: instanceID, } BeforeEach(func() { pid := "1234" basepath := tmpInstanceDataDir instanceDir := path.Join(basepath, instanceID) mkdirErr := os.MkdirAll(instanceDir, 0755) Ω(mkdirErr).ToNot(HaveOccurred()) pidFilePath := instanceDir + "/redis-server.pid" ioutil.WriteFile(pidFilePath, []byte(pid), 0644) }) It("returns its value", func() { pidFromFile, err := repo.InstancePid(instance.ID) Ω(err).ToNot(HaveOccurred()) Ω(pidFromFile).To(Equal(1234)) }) }) Context("when a pid file does not exist", func() { instanceID := uuid.NewRandom().String() instance := redis.Instance{ ID: instanceID, } It("returns an error", func() { _, err := repo.InstancePid(instance.ID) Ω(err).To(HaveOccurred())