Beispiel #1
0
			})

			yaml, err := manifest.ToYAML()
			Expect(err).NotTo(HaveOccurred())
			Expect(yaml).To(MatchYAML(consulManifest))
		})

		It("returns a YAML representation of the turbulence manifest", func() {
			turbulenceManifest, err := ioutil.ReadFile("fixtures/turbulence_manifest.yml")
			Expect(err).NotTo(HaveOccurred())

			manifest := destiny.NewTurbulence(destiny.Config{
				DirectorUUID: "some-director-uuid",
				Name:         "turbulence",
				IAAS:         destiny.Warden,
				BOSH: destiny.ConfigBOSH{
					Target:   "some-bosh-target",
					Username: "******",
					Password: "******",
				},
			})

			yaml, err := manifest.ToYAML()
			Expect(err).NotTo(HaveOccurred())
			Expect(yaml).To(MatchYAML(turbulenceManifest))
		})
	})

	Describe("FromYAML", func() {
		It("returns a Manifest matching the given YAML", func() {
			consulManifest, err := ioutil.ReadFile("fixtures/consul_manifest.yml")
			Expect(err).NotTo(HaveOccurred())
				Region:                config.AWS.Region,
				Subnet:                config.AWS.Subnet,
			}
			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)
var _ = Describe("Turbulence Manifest", func() {
	Describe("NewTurbulence", func() {
		It("generates a valid Turbulence AWS manifest", func() {
			manifest := destiny.NewTurbulence(destiny.Config{
				Name:         "turbulence",
				DirectorUUID: "some-director-uuid",
				IAAS:         destiny.AWS,
				BOSH: destiny.ConfigBOSH{
					Target:         "some-bosh-target",
					Username:       "******",
					Password:       "******",
					DirectorCACert: "some-ca-cert",
				},
				AWS: destiny.ConfigAWS{
					AccessKeyID:           "some-access-key-id",
					SecretAccessKey:       "some-secret-access-key",
					DefaultKeyName:        "some-default-key-name",
					DefaultSecurityGroups: []string{"some-default-security-group1"},
					Region:                "some-region",
					Subnet:                "subnet-1234",
				},
				Registry: destiny.ConfigRegistry{
					Host:     "some-registry-host",
					Password: "******",
					Port:     25777,
					Username: "******",
				},
			})

			Expect(manifest).To(Equal(destiny.Manifest{
				DirectorUUID: "some-director-uuid",