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

Commit

Permalink
Update to the latest destiny
Browse files Browse the repository at this point in the history
[#101812768]

Signed-off-by: George Dean <gdean@pivotal.io>
  • Loading branch information
christianang authored and gdean123 committed Mar 30, 2016
1 parent 7ae4568 commit 481918d
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 68 deletions.
4 changes: 2 additions & 2 deletions src/acceptance-tests/deploy/encryption_key_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

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

var _ = Describe("Encryption key rotation", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
kv consulclient.HTTPKV
testKey string
testValue string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

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

var _ = Describe("Multiple instance rolling deploys", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
kv consulclient.HTTPKV
testKey string
testValue string
Expand Down
4 changes: 2 additions & 2 deletions src/acceptance-tests/deploy/scale_down_instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

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

var _ = Describe("Scaling down instances", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
kv consulclient.HTTPKV
testKey string
testValue string
Expand Down
4 changes: 2 additions & 2 deletions src/acceptance-tests/deploy/scale_up_instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

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

var _ = Describe("Scaling up Instances", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
kv consulclient.HTTPKV
testKey string
testValue string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

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

var _ = Describe("Single instance rolling deploys", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
kv consulclient.HTTPKV
testKey string
testValue string
Expand Down
4 changes: 2 additions & 2 deletions src/acceptance-tests/deploy/tls_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -151,7 +151,7 @@ kz9FT4jnME5mUOg+0p5XEfoZUhklll3HWTU/hWVwJzplIRAz3mk=

var _ = Describe("TLS key rotation", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
kv consulclient.HTTPKV
spammer *helpers.Spammer
)
Expand Down
11 changes: 6 additions & 5 deletions src/acceptance-tests/dns/health_check_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"
"github.com/pivotal-cf-experimental/destiny/core"

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

var _ = Describe("Health Check", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
agent consulclient.AgentStartStopper
healthCheckURL string
)
Expand Down Expand Up @@ -51,10 +52,10 @@ var _ = Describe("Health Check", func() {

It("deregisters a service if the health check fails", func() {
By("registering a service", func() {
manifest.Jobs[0].Properties.Consul.Agent.Services = destiny.JobPropertiesConsulAgentServices{
"some-service": destiny.JobPropertiesConsulAgentService{
manifest.Jobs[0].Properties.Consul.Agent.Services = core.JobPropertiesConsulAgentServices{
"some-service": core.JobPropertiesConsulAgentService{
Name: "some-service-name",
Check: &destiny.JobPropertiesConsulAgentServiceCheck{
Check: &core.JobPropertiesConsulAgentServiceCheck{
Name: "some-service-check",
Script: fmt.Sprintf("curl -f %s", healthCheckURL),
Interval: "10s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"
"github.com/pivotal-cf-experimental/destiny/core"

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

var _ = Describe("Multiple hosts multiple services", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
agent consulclient.AgentStartStopper
)

Expand Down Expand Up @@ -47,18 +48,18 @@ var _ = Describe("Multiple hosts multiple services", func() {

It("discovers multiples services on multiple hosts", func() {
By("registering services", func() {
manifest.Jobs[0].Properties.Consul.Agent.Services = destiny.JobPropertiesConsulAgentServices{
"some-service": destiny.JobPropertiesConsulAgentService{
manifest.Jobs[0].Properties.Consul.Agent.Services = core.JobPropertiesConsulAgentServices{
"some-service": core.JobPropertiesConsulAgentService{
Name: "some-service-name",
Check: &destiny.JobPropertiesConsulAgentServiceCheck{
Check: &core.JobPropertiesConsulAgentServiceCheck{
Name: "some-service-check",
Script: "/bin/ls",
Interval: "1m",
},
},
"some-other-service": destiny.JobPropertiesConsulAgentService{
"some-other-service": core.JobPropertiesConsulAgentService{
Name: "some-other-service-name",
Check: &destiny.JobPropertiesConsulAgentServiceCheck{
Check: &core.JobPropertiesConsulAgentServiceCheck{
Name: "some-other-service-check",
Script: "/bin/ls",
Interval: "1m",
Expand Down
15 changes: 8 additions & 7 deletions src/acceptance-tests/dns/single_host_multiple_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/miekg/dns"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"
"github.com/pivotal-cf-experimental/destiny/core"

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

var _ = Describe("Single host multiple services", func() {
var (
manifest destiny.Manifest
manifest consul.Manifest
agent consulclient.AgentStartStopper
)

Expand Down Expand Up @@ -48,19 +49,19 @@ var _ = Describe("Single host multiple services", func() {

It("discovers multiples services on a single host", func() {
By("registering services", func() {
manifest.Jobs[0].Properties.Consul.Agent.Services = destiny.JobPropertiesConsulAgentServices{
"some-service": destiny.JobPropertiesConsulAgentService{
manifest.Jobs[0].Properties.Consul.Agent.Services = core.JobPropertiesConsulAgentServices{
"some-service": core.JobPropertiesConsulAgentService{
Name: "some-service-name",
Check: &destiny.JobPropertiesConsulAgentServiceCheck{
Check: &core.JobPropertiesConsulAgentServiceCheck{
Name: "some-service-check",
Script: fmt.Sprintf("curl http://%s:6769/health_check", manifest.Jobs[1].Networks[0].StaticIPs[0]),
Interval: "1m",
},
Tags: []string{"some-service-tag"},
},
"some-other-service": destiny.JobPropertiesConsulAgentService{
"some-other-service": core.JobPropertiesConsulAgentService{
Name: "some-other-service-name",
Check: &destiny.JobPropertiesConsulAgentServiceCheck{
Check: &core.JobPropertiesConsulAgentServiceCheck{
Name: "some-other-service-check",
Script: fmt.Sprintf("curl http://%s:6769/health_check", manifest.Jobs[1].Networks[0].StaticIPs[0]),
Interval: "1m",
Expand Down
10 changes: 5 additions & 5 deletions src/acceptance-tests/testing/consulclient/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"syscall"

"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand All @@ -32,10 +32,10 @@ var _ = Describe("Agent", func() {
ConfigDir: configDir,
DataDir: "/tmp/client",
Domain: "cf.internal",
Key: destiny.AgentKey,
Cert: destiny.AgentCert,
CACert: destiny.CACert,
Encrypt: destiny.Encrypt,
Key: consul.AgentKey,
Cert: consul.AgentCert,
CACert: consul.CACert,
Encrypt: consul.Encrypt,
ServerName: "consul agent",
RetryJoin: []string{"127.0.0.1:8301"},
})
Expand Down
33 changes: 23 additions & 10 deletions src/acceptance-tests/testing/helpers/deploy_consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import (

"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"
"github.com/pivotal-cf-experimental/destiny/core"
"github.com/pivotal-cf-experimental/destiny/iaas"
)

func DeployConsulWithInstanceCount(count int, client bosh.Client, config Config) (manifest destiny.Manifest, kv consulclient.HTTPKV, err error) {
func DeployConsulWithInstanceCount(count int, client bosh.Client, config Config) (manifest consul.Manifest, kv consulclient.HTTPKV, err error) {
guid, err := NewGUID()
if err != nil {
return
Expand All @@ -25,30 +27,41 @@ func DeployConsulWithInstanceCount(count int, client bosh.Client, config Config)
return
}

manifestConfig := destiny.Config{
manifestConfig := consul.Config{
DirectorUUID: info.UUID,
Name: fmt.Sprintf("consul-%s", guid),
}

var iaasConfig iaas.Config
switch info.CPI {
case "aws_cpi":
manifestConfig.IAAS = destiny.AWS
iaasConfig = iaas.AWSConfig{
AccessKeyID: config.AWS.AccessKeyID,
SecretAccessKey: config.AWS.SecretAccessKey,
DefaultKeyName: config.AWS.DefaultKeyName,
DefaultSecurityGroups: config.AWS.DefaultSecurityGroups,
Region: config.AWS.Region,
Subnet: config.AWS.Subnet,
RegistryHost: config.Registry.Host,
RegistryPassword: config.Registry.Password,
RegistryPort: config.Registry.Port,
RegistryUsername: config.Registry.Username,
}
if config.AWS.Subnet != "" {
manifestConfig.AWS.Subnet = config.AWS.Subnet
manifestConfig.IPRange = "10.0.4.0/24"
} else {
err = errors.New("AWSSubnet is required for AWS IAAS deployment")
return
}
case "warden_cpi":
iaasConfig = iaas.NewWardenConfig()
manifestConfig.IPRange = "10.244.4.0/24"
manifestConfig.IAAS = destiny.Warden
default:
err = errors.New("unknown infrastructure type")
return
}

manifest = destiny.NewConsul(manifestConfig)
manifest = consul.NewManifest(manifestConfig, iaasConfig)

manifest.Jobs[0], manifest.Properties = SetJobInstanceCount(manifest.Jobs[0], manifest.Networks[0], manifest.Properties, count)

Expand All @@ -62,7 +75,7 @@ func DeployConsulWithInstanceCount(count int, client bosh.Client, config Config)
return
}

manifest, err = destiny.FromYAML(yaml)
manifest, err = consul.FromYAML(yaml)
if err != nil {
return
}
Expand All @@ -76,7 +89,7 @@ func DeployConsulWithInstanceCount(count int, client bosh.Client, config Config)
return
}

func SetJobInstanceCount(job destiny.Job, network destiny.Network, properties destiny.Properties, count int) (destiny.Job, destiny.Properties) {
func SetJobInstanceCount(job core.Job, network core.Network, properties consul.Properties, count int) (core.Job, consul.Properties) {
job.Instances = count
for i, net := range job.Networks {
if net.Name == network.Name {
Expand All @@ -89,7 +102,7 @@ func SetJobInstanceCount(job destiny.Job, network destiny.Network, properties de
return job, properties
}

func NewConsulAgent(manifest destiny.Manifest, count int) (*consulclient.Agent, error) {
func NewConsulAgent(manifest consul.Manifest, count int) (*consulclient.Agent, error) {
members := manifest.ConsulMembers()

if len(members) != count {
Expand Down
4 changes: 2 additions & 2 deletions src/acceptance-tests/turbulence/kill_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
"github.com/pivotal-cf-experimental/bosh-test/bosh"
"github.com/pivotal-cf-experimental/destiny"
"github.com/pivotal-cf-experimental/destiny/consul"

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

var _ = Describe("KillVm", func() {
var (
consulManifest destiny.Manifest
consulManifest consul.Manifest
kv consulclient.HTTPKV

spammer *helpers.Spammer
Expand Down
Loading

0 comments on commit 481918d

Please sign in to comment.