var ( manifest consul.ManifestV2 kv consulclient.HTTPKV spammer *helpers.Spammer ) BeforeEach(func() { var err error manifest, kv, err = helpers.DeployConsulWithInstanceCount("tls-key-rotation", 3, boshClient, config) Expect(err).NotTo(HaveOccurred()) Eventually(func() ([]bosh.VM, error) { return helpers.DeploymentVMs(boshClient, manifest.Name) }, "1m", "10s").Should(ConsistOf(helpers.GetVMsFromManifest(manifest))) spammer = helpers.NewSpammer(kv, 1*time.Second, "test-consumer-0") }) AfterEach(func() { if !CurrentGinkgoTestDescription().Failed { err := boshClient.DeleteDeployment(manifest.Name) Expect(err).NotTo(HaveOccurred()) } }) It("successfully rolls with new tls keys and certs", func() { By("spamming the kv store", func() { spammer.Spam() }) By("adding a new ca cert", func() {
) var _ = Describe("Spammer", func() { var ( kv *fakeKV spammer *helpers.Spammer prefix string ) Context("Check", func() { BeforeEach(func() { prefix = fmt.Sprintf("some-prefix-%v", rand.Int()) kv = newFakeKV() kv.AddressCall.Returns.Address = "http://some-address/consul" spammer = helpers.NewSpammer(kv, time.Duration(0), prefix) spammer.Spam() Eventually(func() int { return kv.SetCall.CallCount.Value() }).Should(BeNumerically(">", 1)) spammer.Stop() }) It("gets all the sets", func() { Expect(spammer.Check()).To(Succeed()) Expect(kv.GetCall.CallCount).Should(Equal(kv.SetCall.CallCount.Value())) }) It("returns an error when a key doesn't exist", func() {
if config.WindowsClients { Skip("bosh 1.0 style manifests do not support windows vms") } By("deploying 3 node cluster across two AZs with BOSH 1.0 manifest", func() { var err error manifest, err = helpers.DeployMultiAZConsul("migrate-instance-group", boshClient, config) Expect(err).NotTo(HaveOccurred()) Eventually(func() ([]bosh.VM, error) { return helpers.DeploymentVMs(boshClient, manifest.Name) }, "1m", "10s").Should(ConsistOf(helpers.GetVMsFromManifestV1(manifest))) for i, ip := range manifest.Jobs[2].Networks[0].StaticIPs { kv = consulclient.NewHTTPKV(fmt.Sprintf("http://%s:6769", ip)) spammers = append(spammers, helpers.NewSpammer(kv, 1*time.Second, fmt.Sprintf("test-consumer-%d", i))) } }) By("starting spammer", func() { for _, spammer := range spammers { spammer.Spam() } }) By("deploying 3 node cluster across two AZs with BOSH 2.0 manifest", func() { manifestv2, err := helpers.DeployMultiAZConsulMigration(boshClient, config, manifest.Name) Expect(err).NotTo(HaveOccurred()) Eventually(func() ([]bosh.VM, error) { return helpers.DeploymentVMs(boshClient, manifestv2.Name)