Ejemplo n.º 1
0
var _ = BeforeSuite(func() {
	goPath = helpers.SetupGoPath()
	gemfilePath := helpers.SetupFastBosh()
	config = helpers.LoadConfig()
	boshOperationTimeout := helpers.GetBoshOperationTimeout(config)
	bosh = helpers.NewBosh(gemfilePath, goPath, config.BoshTarget, boshOperationTimeout)

	consulManifestGeneration = filepath.Join(goPath, "src", "acceptance-tests", "scripts", "generate-consul-deployment-manifest")

	err := os.Chdir(goPath)
	Expect(err).ToNot(HaveOccurred())

	directorUUIDStub = bosh.TargetDeployment()
	createConsulStub()
	bosh.CreateAndUploadRelease(goPath, consulRelease)
})

var _ = AfterSuite(func() {
	if bosh == nil {
		return
	}

	By("delete release")
	bosh.Command("-n", "delete", "release", consulRelease)
})

func createConsulStub() {
	By("creating the consul overrides stub")
	consulStub := fmt.Sprintf(`---
name_overrides:
		directorUUIDStub,
		helpers.TurbulenceInstanceCountOverridesStubPath,
		helpers.TurbulencePersistentDiskOverridesStubPath,
		config.IAASSettingsTurbulenceStubPath,
		config.TurbulencePropertiesStubPath,
		turbulenceNameOverrideStub,
	)

	By("uploading the turbulence release")
	Expect(bosh.Command("-n", "upload", "release", config.TurbulenceReleaseUrl)).To(Exit(0))

	By("deploying the turbulence release")
	Expect(bosh.Command("-n", "deploy")).To(Exit(0))

	createEtcdStub()
	bosh.CreateAndUploadRelease(goPath, etcdRelease)
})

var _ = AfterSuite(func() {
	if bosh == nil {
		return
	}

	By("delete etcd release")
	bosh.Command("-n", "delete", "release", etcdRelease)

	By("delete turbulence deployment")
	bosh.Command("-n", "delete", "deployment", turbulenceDeployment)

	By("deleting the cpi release")
	bosh.Command("-n", "delete", "release", config.CPIReleaseName)