var err error conf, err = config.DefaultConfig() Ω(err).ShouldNot(HaveOccured()) etcdAdapter = storeadapter.NewETCDStoreAdapter(etcdRunner.NodeURLS(), conf.StoreMaxConcurrentRequests) err = etcdAdapter.Connect() Ω(err).ShouldNot(HaveOccured()) app1 = app.NewApp() app2 = app.NewApp() app3 = app.NewApp() store = NewStore(conf, etcdAdapter) }) AfterEach(func() { etcdAdapter.Disconnect() }) Describe("Saving desired state ", func() { BeforeEach(func() { err := store.SaveDesiredState([]models.DesiredAppState{ app1.DesiredState(0), app2.DesiredState(0), }) Ω(err).ShouldNot(HaveOccured()) }) It("can stores the passed in desired state", func() { nodes, err := etcdAdapter.List("/desired") Ω(err).ShouldNot(HaveOccured()) Ω(nodes).Should(HaveLen(2))
storeAdapter = storeadapter.NewETCDStoreAdapter(storeRunner.NodeURLS(), workerpool.NewWorkerPool(concurrency)) err := storeAdapter.Connect() Ω(err).ShouldNot(HaveOccured()) } else if storeType == "Zookeeper" { storeRunner = storerunner.NewZookeeperClusterRunner(2181, nodes) storeRunner.Start() storeAdapter = storeadapter.NewZookeeperStoreAdapter(storeRunner.NodeURLS(), workerpool.NewWorkerPool(concurrency), &timeprovider.RealTimeProvider{}, time.Second) err := storeAdapter.Connect() Ω(err).ShouldNot(HaveOccured()) } }) AfterEach(func() { storeAdapter.Disconnect() storeRunner.Stop() storeRunner = nil }) randomBytes := func(sizeInBytes int) []byte { seedBytes := []byte{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'} randomBytes := make([]byte, sizeInBytes) for i := 0; i < sizeInBytes; i++ { randomBytes[i] = seedBytes[rand.Intn(len(seedBytes))] } return randomBytes } for _, recordSize := range recordSizes {