Exemple #1
0
				Expect(err).ToNot(HaveOccurred())
			})

			By("reading the value from etcd", func() {
				value, err := etcdClient.Get(testKey1)
				Expect(err).ToNot(HaveOccurred())
				Expect(value).To(Equal(testValue1))
			})

			By("setting a new persistent value", func() {
				err := etcdClient.Set(testKey2, testValue2)
				Expect(err).ToNot(HaveOccurred())
			})

			By("fixing the deployment", func() {
				yaml, err := etcdManifest.ToYAML()
				Expect(err).NotTo(HaveOccurred())

				err = client.ScanAndFix(yaml)
				Expect(err).NotTo(HaveOccurred())

				Eventually(func() ([]bosh.VM, error) {
					return client.DeploymentVMs(etcdManifest.Name)
				}, "1m", "10s").Should(ConsistOf([]bosh.VM{
					{"running"},
					{"running"},
					{"running"},
				}))
			})

			By("reading each value from the resurrected VM", func() {
		By("setting a persistent value", func() {
			etcdClient := helpers.NewEtcdClient([]string{
				fmt.Sprintf("http://%s:4001", manifest.Properties.Etcd.Machines[0]),
			})

			err := etcdClient.Set(testKey, testValue)
			Expect(err).ToNot(HaveOccurred())
		})

		By("scaling up to 3 nodes", func() {
			manifest.Jobs[0], manifest.Properties = destiny.SetJobInstanceCount(manifest.Jobs[0], manifest.Networks[0], manifest.Properties, 3)

			members := manifest.EtcdMembers()
			Expect(members).To(HaveLen(3))

			yaml, err := manifest.ToYAML()
			Expect(err).NotTo(HaveOccurred())

			var wg sync.WaitGroup
			done := make(chan struct{})

			keysChan := helpers.SpamEtcd(done, &wg, manifest.Properties.Etcd.Machines)

			err = client.Deploy(yaml)
			Expect(err).NotTo(HaveOccurred())

			Eventually(func() ([]bosh.VM, error) {
				return client.DeploymentVMs(manifest.Name)
			}, "1m", "10s").Should(ConsistOf([]bosh.VM{
				{"running"},
				{"running"},
			}
			manifestConfig.Registry = destiny.ConfigRegistry{
				Host:     config.Registry.Host,
				Port:     config.Registry.Port,
				Username: config.Registry.Username,
				Password: config.Registry.Password,
			}
		case "warden_cpi":
			manifestConfig.IAAS = destiny.Warden
		default:
			Fail("unknown infrastructure type")
		}

		turbulenceManifest = destiny.NewTurbulence(manifestConfig)

		yaml, err := turbulenceManifest.ToYAML()
		Expect(err).NotTo(HaveOccurred())

		yaml, err = client.ResolveManifestVersions(yaml)
		Expect(err).NotTo(HaveOccurred())

		turbulenceManifest, err = destiny.FromYAML(yaml)
		Expect(err).NotTo(HaveOccurred())

		err = client.Deploy(yaml)
		Expect(err).NotTo(HaveOccurred())

		Eventually(func() ([]bosh.VM, error) {
			return client.DeploymentVMs(turbulenceManifest.Name)
		}, "1m", "10s").Should(ConsistOf([]bosh.VM{
			{"running"},