本文整理匯總了Golang中acceptance-tests/testing/destiny.Manifest類的典型用法代碼示例。如果您正苦於以下問題:Golang Manifest類的具體用法?Golang Manifest怎麽用?Golang Manifest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Manifest類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewKV
func NewKV(manifest destiny.Manifest, count int) (kv consul.KV, err error) {
members := manifest.ConsulMembers()
if len(members) != count {
err = fmt.Errorf("expected %d consul members, found %d", count, len(members))
return
}
consulMemberAddresses := []string{}
for _, member := range members {
consulMemberAddresses = append(consulMemberAddresses, member.Address)
}
dataDir, err := ioutil.TempDir("", "consul")
if err != nil {
return
}
configDir, err := ioutil.TempDir("", "consul-config")
if err != nil {
return
}
var encryptKey string
if len(manifest.Properties.Consul.EncryptKeys) > 0 {
key := manifest.Properties.Consul.EncryptKeys[0]
encryptKey = base64.StdEncoding.EncodeToString(pbkdf2.Key([]byte(key), []byte(""), 20000, 16, sha1.New))
}
agent := consul.NewAgent(consul.AgentOptions{
DataDir: dataDir,
RetryJoin: consulMemberAddresses,
ConfigDir: configDir,
Domain: "cf.internal",
Key: manifest.Properties.Consul.AgentKey,
Cert: manifest.Properties.Consul.AgentCert,
CACert: manifest.Properties.Consul.CACert,
Encrypt: encryptKey,
ServerName: "consul agent",
})
agentLocation := "http://127.0.0.1:8500"
kv = consul.NewManagedKV(consul.ManagedKVConfig{
Agent: agent,
KV: consul.NewHTTPKV(agentLocation),
Catalog: consul.NewHTTPCatalog(agentLocation),
})
return
}
示例2:
package deploy_test
import (
"acceptance-tests/testing/bosh"
"acceptance-tests/testing/consul"
"acceptance-tests/testing/destiny"
"acceptance-tests/testing/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Scaling down instances", func() {
var (
manifest destiny.Manifest
kv consul.KV
testKey string
testValue string
)
AfterEach(func() {
err := client.DeleteDeployment(manifest.Name)
Expect(err).NotTo(HaveOccurred())
})
Describe("scaling from 3 nodes to 1", func() {
BeforeEach(func() {
guid, err := helpers.NewGUID()
Expect(err).NotTo(HaveOccurred())
testKey = "consul-key-" + guid
testValue = "consul-value-" + guid
示例3:
EncryptKeys: []string{destiny.EncryptKey},
RequireSSL: true,
},
},
}))
})
})
Describe("ConsulMembers", func() {
Context("when there is a single job with a single instance", func() {
It("returns a list of members in the cluster", func() {
manifest := destiny.Manifest{
Jobs: []destiny.Job{
{
Instances: 1,
Networks: []destiny.JobNetwork{{
StaticIPs: []string{"10.244.4.2"},
}},
},
},
}
members := manifest.ConsulMembers()
Expect(members).To(Equal([]destiny.ConsulMember{{
Address: "10.244.4.2",
}}))
})
})
Context("when there are multiple jobs with multiple instances", func() {
It("returns a list of members in the cluster", func() {
manifest := destiny.Manifest{
示例4:
import (
"acceptance-tests/testing/bosh"
"acceptance-tests/testing/consul"
"acceptance-tests/testing/destiny"
"acceptance-tests/testing/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("KillVm", func() {
var (
consulManifest destiny.Manifest
kv consul.KV
testKey string
testValue string
)
BeforeEach(func() {
guid, err := helpers.NewGUID()
Expect(err).NotTo(HaveOccurred())
testKey = "consul-key-" + guid
testValue = "consul-value-" + guid
consulManifest, kv, err = helpers.DeployConsulWithInstanceCount(3, client, config)
Expect(err).NotTo(HaveOccurred())
Eventually(func() ([]bosh.VM, error) {
示例5: TestTurbulence
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestTurbulence(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "turbulence")
}
var (
config helpers.Config
client bosh.Client
turbulenceManifest destiny.Manifest
turbulenceClient turbulence.Client
)
var _ = BeforeSuite(func() {
configPath, err := helpers.ConfigPath()
Expect(err).NotTo(HaveOccurred())
config, err = helpers.LoadConfig(configPath)
Expect(err).NotTo(HaveOccurred())
client = bosh.NewClient(bosh.Config{
URL: fmt.Sprintf("https://%s:25555", config.BOSH.Target),
Username: config.BOSH.Username,
Password: config.BOSH.Password,
示例6:
package deploy_test
import (
"acceptance-tests/testing/bosh"
"acceptance-tests/testing/consul"
"acceptance-tests/testing/destiny"
"acceptance-tests/testing/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Single instance rolling deploys", func() {
var (
manifest destiny.Manifest
kv consul.KV
testKey string
testValue string
)
BeforeEach(func() {
guid, err := helpers.NewGUID()
Expect(err).NotTo(HaveOccurred())
testKey = "consul-key-" + guid
testValue = "consul-value-" + guid
manifest, kv, err = helpers.DeployConsulWithInstanceCount(1, client, config)
Expect(err).NotTo(HaveOccurred())
Eventually(func() ([]bosh.VM, error) {
return client.DeploymentVMs(manifest.Name)
示例7:
package deploy_test
import (
"acceptance-tests/testing/bosh"
"acceptance-tests/testing/consul"
"acceptance-tests/testing/destiny"
"acceptance-tests/testing/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Encryption key rotation", func() {
var (
manifest destiny.Manifest
kv consul.KV
testKey string
testValue string
)
BeforeEach(func() {
guid, err := helpers.NewGUID()
Expect(err).NotTo(HaveOccurred())
testKey = "consul-key-" + guid
testValue = "consul-value-" + guid
manifest, kv, err = helpers.DeployConsulWithInstanceCount(3, client, config)
Expect(err).NotTo(HaveOccurred())
Eventually(func() ([]bosh.VM, error) {
return client.DeploymentVMs(manifest.Name)