Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Unpend turbulence test
Browse files Browse the repository at this point in the history
- bump destiny
- refactor to support parallel nodes

[#116265339]
  • Loading branch information
zankich committed Sep 20, 2016
1 parent 9dddcd0 commit 719b161
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 108 deletions.
8 changes: 4 additions & 4 deletions src/acceptance-tests/testing/helpers/deploy_turbulence.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ func DeployTurbulence(client bosh.Client, config Config) (turbulence.Manifest, e

iaasConfig = awsConfig
case "warden_cpi":
iaasConfig = iaas.NewWardenConfig()

var cidrBlock string
cidrPool := NewCIDRPool("10.244.4.0", 24, 27)
cidrBlock, err = cidrPool.Get(ginkgoConfig.GinkgoConfig.ParallelNode - 1)
cidrPool := core.NewCIDRPool("10.244.16.0", 24, 27)
cidrBlock, err = cidrPool.Get(ginkgoConfig.GinkgoConfig.ParallelNode)
if err != nil {
return turbulence.Manifest{}, err
}

manifestConfig.IPRange = cidrBlock
iaasConfig = iaas.NewWardenConfig()
default:
return turbulence.Manifest{}, errors.New("unknown infrastructure type")
}
Expand Down
19 changes: 15 additions & 4 deletions src/acceptance-tests/turbulence/kill_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = PDescribe("KillVm", func() {
var _ = Describe("KillVm", func() {
KillVMTest := func(enableSSL bool) {
var (
turbulenceManifest turbulence.Manifest
Expand Down Expand Up @@ -65,7 +65,17 @@ var _ = PDescribe("KillVm", func() {
AfterEach(func() {
By("deleting the deployment", func() {
if !CurrentGinkgoTestDescription().Failed {
err := boshClient.DeleteDeployment(etcdManifest.Name)
yaml, err := etcdManifest.ToYAML()
Expect(err).NotTo(HaveOccurred())

Eventually(func() error {
return boshClient.ScanAndFixAll(yaml)
}, "5m", "1m").ShouldNot(HaveOccurred())

err = boshClient.DeleteDeployment(etcdManifest.Name)
Expect(err).NotTo(HaveOccurred())

err = boshClient.DeleteDeployment(turbulenceManifest.Name)
Expect(err).NotTo(HaveOccurred())
}
})
Expand Down Expand Up @@ -98,8 +108,9 @@ var _ = PDescribe("KillVm", func() {
yaml, err := etcdManifest.ToYAML()
Expect(err).NotTo(HaveOccurred())

err = boshClient.ScanAndFixAll(yaml)
Expect(err).NotTo(HaveOccurred())
Eventually(func() error {
return boshClient.ScanAndFixAll(yaml)
}, "5m", "1m").ShouldNot(HaveOccurred())

Eventually(func() ([]bosh.VM, error) {
return helpers.DeploymentVMs(boshClient, etcdManifest.Name)
Expand Down
99 changes: 0 additions & 99 deletions src/acceptance-tests/turbulence/turbulence_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ package turbulence_test

import (
"acceptance-tests/testing/helpers"
"errors"
"fmt"
"time"

ginkgoConfig "github.com/onsi/ginkgo/config"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
turbulenceclient "github.com/pivotal-cf-experimental/bosh-test/turbulence"
"github.com/pivotal-cf-experimental/destiny/core"
"github.com/pivotal-cf-experimental/destiny/iaas"
"github.com/pivotal-cf-experimental/destiny/turbulence"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -45,98 +40,4 @@ var _ = BeforeSuite(func() {
Password: config.BOSH.Password,
AllowInsecureSSL: true,
})

By("deploying turbulence", func() {
info, err := boshClient.Info()
Expect(err).NotTo(HaveOccurred())

guid, err := helpers.NewGUID()
Expect(err).NotTo(HaveOccurred())

manifestConfig := turbulence.Config{
DirectorUUID: info.UUID,
Name: "turbulence-etcd-" + guid,
BOSH: turbulence.ConfigBOSH{
Target: config.BOSH.Target,
Username: config.BOSH.Username,
Password: config.BOSH.Password,
DirectorCACert: config.BOSH.DirectorCACert,
},
}

var iaasConfig iaas.Config
switch info.CPI {
case "aws_cpi":
manifestConfig.IPRange = "10.0.16.0/24"
awsConfig := iaas.AWSConfig{
AccessKeyID: config.AWS.AccessKeyID,
SecretAccessKey: config.AWS.SecretAccessKey,
DefaultKeyName: config.AWS.DefaultKeyName,
DefaultSecurityGroups: config.AWS.DefaultSecurityGroups,
Region: config.AWS.Region,
RegistryHost: config.Registry.Host,
RegistryPassword: config.Registry.Password,
RegistryPort: config.Registry.Port,
RegistryUsername: config.Registry.Username,
}
if config.AWS.Subnet == "" {
err = errors.New("AWSSubnet is required for AWS IAAS deployment")
return
}
var cidrBlock string
cidrPool := core.NewCIDRPool("10.0.16.0", 24, 27)
cidrBlock, err = cidrPool.Get(ginkgoConfig.GinkgoConfig.ParallelNode)
if err != nil {
return
}

manifestConfig.IPRange = cidrBlock
awsConfig.Subnets = []iaas.AWSConfigSubnet{{ID: config.AWS.Subnet, Range: cidrBlock, AZ: "us-east-1a"}}

iaasConfig = awsConfig
case "warden_cpi":
iaasConfig = iaas.NewWardenConfig()
manifestConfig.IPRange = "10.244.16.0/24"
default:
Fail("unknown infrastructure type")
}

turbulenceManifest, err = turbulence.NewManifest(manifestConfig, iaasConfig)
Expect(err).NotTo(HaveOccurred())

yaml, err := turbulenceManifest.ToYAML()
Expect(err).NotTo(HaveOccurred())

yaml, err = boshClient.ResolveManifestVersions(yaml)
Expect(err).NotTo(HaveOccurred())

turbulenceManifest, err = turbulence.FromYAML(yaml)
Expect(err).NotTo(HaveOccurred())

_, err = boshClient.Deploy(yaml)
Expect(err).NotTo(HaveOccurred())

Eventually(func() ([]bosh.VM, error) {
return helpers.DeploymentVMs(boshClient, turbulenceManifest.Name)
}, "1m", "10s").Should(ConsistOf([]bosh.VM{
{Index: 0, JobName: "api", State: "running"},
}))
})

By("preparing turbulence client", func() {
turbulenceUrl := fmt.Sprintf("https://turbulence:%s@%s:8080",
turbulenceManifest.Properties.TurbulenceAPI.Password,
turbulenceManifest.Jobs[0].Networks[0].StaticIPs[0])

turbulenceClient = turbulenceclient.NewClient(turbulenceUrl, 5*time.Minute, 2*time.Second)
})
})

var _ = AfterSuite(func() {
By("deleting the turbulence deployment", func() {
if !CurrentGinkgoTestDescription().Failed {
err := boshClient.DeleteDeployment(turbulenceManifest.Name)
Expect(err).NotTo(HaveOccurred())
}
})
})

0 comments on commit 719b161

Please sign in to comment.