statefileContents := getStatefileContents(statefilePath) Expect(len(statefileContents.AvailableInstances)).To(Equal(2)) Expect(len(statefileContents.AllocatedInstances)).To(Equal(1)) allocatedInstance := statefileContents.AllocatedInstances[0] Expect(allocatedInstance.Host).To(Equal("10.0.0.1")) Expect(len(statefileContents.InstanceBindings["foo"])).To(Equal(1)) Expect(statefileContents.InstanceBindings["foo"][0]).To(Equal("foo-binding")) }) }) Describe("#IDForHost", func() { It("returns the corresponding instance ID", func() { err := repo.Create("foo") Expect(err).ToNot(HaveOccurred()) Expect(repo.IDForHost(config.RedisConfiguration.Dedicated.Nodes[0])).To(Equal("foo")) }) It("returns an empty string when the host is not allocated", func() { Expect(repo.IDForHost(config.RedisConfiguration.Dedicated.Nodes[0])).To(Equal("")) }) It("returns an empty string when the host is unknown", func() { Expect(repo.IDForHost("nonsense")).To(Equal("")) }) }) })