Host: "10.0.0.3", ID: "dedicated-instance", }, }, } putStatefileContents(statefilePath, statefile) }) Context("When the state file can be read", func() { It("loads its state from the state file", func() { repo, err := redis.NewRemoteRepository(fakeAgentClient, config, logger) Expect(err).ToNot(HaveOccurred()) allocatedInstances, err := repo.AllInstances() Expect(err).ToNot(HaveOccurred()) Expect(repo.InstanceLimit()).To(Equal(3)) Expect(len(allocatedInstances)).To(Equal(1)) Expect(*allocatedInstances[0]).To(Equal(*statefile.AllocatedInstances[0])) }) It("adds new nodes from config", func() { nodes := append(config.RedisConfiguration.Dedicated.Nodes, "10.0.0.4") config.RedisConfiguration.Dedicated.Nodes = nodes repo, err := redis.NewRemoteRepository(fakeAgentClient, config, logger) Expect(err).ToNot(HaveOccurred()) availableInstances := repo.AvailableInstances() Expect(len(availableInstances)).To(Equal(3)) Expect(availableInstances[2].Host).To(Equal("10.0.0.4")) })