コード例 #1
0
				Expect(err).To(MatchError("can't allocate 24 ips from 9 available ips"))
			})
		})
	})

	Describe("EtcdMembers", func() {
		Context("when there is a single job with a single instance", func() {
			It("returns a list of members in the cluster", func() {
				manifest := etcd.Manifest{
					Jobs: []core.Job{
						{
							Instances: 1,
							Networks: []core.JobNetwork{{
								StaticIPs: []string{"10.244.4.2"},
							}},
							Templates: []core.JobTemplate{
								{
									Name:    "etcd",
									Release: "etcd",
								},
							},
						},
					},
				}

				members := manifest.EtcdMembers()
				Expect(members).To(Equal([]etcd.EtcdMember{{
					Address: "10.244.4.2",
				}}))
			})
		})
コード例 #2
0
				Expect(properties.Etcd.Machines).To(Equal([]string{"etcd.service.cf.internal"}))
				Expect(properties.Etcd.Cluster[0].Instances).To(Equal(1))

				job.Instances = 3
				job.Networks[0].StaticIPs = []string{"ip1", "ip2", "ip3"}

				properties = etcd.SetEtcdProperties(job, properties)
				Expect(properties.EtcdTestConsumer.Etcd.Machines).To(Equal([]string{"etcd.service.cf.internal"}))
				Expect(properties.Etcd.Machines).To(Equal([]string{"etcd.service.cf.internal"}))
				Expect(properties.Etcd.Cluster[0].Instances).To(Equal(3))
			})
		})

		Describe("SetJobInstanceCount", func() {
			var (
				manifest etcd.Manifest
			)

			BeforeEach(func() {
				var err error
				manifest, err = etcd.NewManifest(etcd.Config{
					IPRange: "10.244.4.0/24",
				}, iaas.NewWardenConfig())
				Expect(err).NotTo(HaveOccurred())
			})

			It("sets the correct values for instances and static_ips given a count", func() {
				var err error
				job := findJob(manifest, "etcd_z1")
				network := manifest.Networks[0]