"github.com/pivotal-cf-experimental/destiny/core"
	"github.com/pivotal-cf-experimental/destiny/etcd"
	"github.com/pivotal-cf-experimental/destiny/iaas"
	"github.com/pivotal-cf-experimental/destiny/turbulence"
	"github.com/pivotal-cf-experimental/gomegamatchers"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Manifest", func() {
	Describe("NewTLSManifest", func() {
		It("generates a valid Etcd BOSH-Lite manifest", func() {
			manifest, err := etcd.NewTLSManifest(etcd.Config{
				DirectorUUID: "some-director-uuid",
				Name:         "etcd-some-random-guid",
				IPRange:      "10.244.4.0/27",
			}, iaas.NewWardenConfig())
			Expect(err).NotTo(HaveOccurred())

			Expect(manifest.DirectorUUID).To(Equal("some-director-uuid"))

			Expect(manifest.Name).To(Equal("etcd-some-random-guid"))

			Expect(manifest.Releases).To(HaveLen(2))

			Expect(manifest.Releases).To(ContainElement(core.Release{
				Name:    "etcd",
				Version: "latest",
			}))
Exemplo n.º 2
0
				Expect(properties.EtcdTestConsumer.Etcd.Machines).To(Equal(job.Networks[0].StaticIPs))
				Expect(properties.Etcd.Machines).To(Equal(job.Networks[0].StaticIPs))
				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(job.Networks[0].StaticIPs))
				Expect(properties.Etcd.Machines).To(Equal(job.Networks[0].StaticIPs))
				Expect(properties.Etcd.Cluster[0].Instances).To(Equal(3))
			})

			It("does not override the machines property if ssl is enabled", func() {
				manifest, err := etcd.NewTLSManifest(etcd.Config{
					IPRange: "10.244.4.0/24",
				}, iaas.NewWardenConfig())
				Expect(err).NotTo(HaveOccurred())

				job := manifest.Jobs[0]
				properties := manifest.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(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"}))