}, iaas.NewWardenConfig())
				Expect(err).NotTo(HaveOccurred())

				Expect(manifest.Jobs).To(HaveLen(3))
				Expect(manifest.Jobs[1].Templates).To(HaveLen(3))
				Expect(manifest.Jobs[1].Templates[2].Name).To(Equal("iptables_agent"))
				Expect(manifest.Jobs[1].Templates[2].Release).To(Equal("etcd"))
			})
		})
	})

	Describe("NewManifest", func() {
		It("generates a valid Etcd BOSH-Lite manifest", func() {
			manifest, err := etcd.NewManifest(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(1))

			Expect(manifest.Releases).To(ContainElement(core.Release{
				Name:    "etcd",
				Version: "latest",
			}))
Пример #2
0
import (
	"github.com/pivotal-cf-experimental/destiny/core"
	"github.com/pivotal-cf-experimental/destiny/etcd"
	"github.com/pivotal-cf-experimental/destiny/iaas"

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

var _ = Describe("Manifest", func() {
	Describe("Job", func() {
		Describe("SetEtcdProperties", func() {
			It("updates the etcd and testconsumer properties to match the current job configuration", func() {
				manifest, err := etcd.NewManifest(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(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))