本文整理匯總了Golang中github.com/cloudfoundry-incubator/cf-test-helpers/generator.PrefixedRandomName函數的典型用法代碼示例。如果您正苦於以下問題:Golang PrefixedRandomName函數的具體用法?Golang PrefixedRandomName怎麽用?Golang PrefixedRandomName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PrefixedRandomName函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: initiateBrokerConfig
func initiateBrokerConfig(serviceBrokerAppName string) string {
brokerConfigJson := helpers.CurlApp(serviceBrokerAppName, "/config")
var brokerConfigMap customMap
err := json.Unmarshal([]byte(brokerConfigJson), &brokerConfigMap)
Expect(err).NotTo(HaveOccurred())
dashboardClientId := generator.PrefixedRandomName("RATS-DASHBOARD-ID-")
serviceName := generator.PrefixedRandomName("RATS-SERVICE-")
serviceId := generator.PrefixedRandomName("RATS-SERVICE-ID-")
services := brokerConfigMap.key("behaviors").key("catalog").key("body")["services"].([]interface{})
service := services[0].(map[string]interface{})
service["dashboard_client"].(map[string]interface{})["id"] = dashboardClientId
service["name"] = serviceName
service["id"] = serviceId
plans := service["plans"].([]interface{})
for i, plan := range plans {
servicePlanId := generator.PrefixedRandomName(fmt.Sprintf("RATS-SERVICE-PLAN-ID-%d-", i))
plan.(map[string]interface{})["id"] = servicePlanId
}
changedJson, err := json.Marshal(brokerConfigMap)
Expect(err).NotTo(HaveOccurred())
helpers.CurlApp(serviceBrokerAppName, "/config", "-X", "POST", "-d", string(changedJson))
return serviceName
}
示例2: NewRegularTestSpace
func NewRegularTestSpace(cfg spaceConfig, quotaLimit string) *TestSpace {
return NewBaseTestSpace(
generator.PrefixedRandomName(cfg.GetNamePrefix(), "SPACE"),
generator.PrefixedRandomName(cfg.GetNamePrefix(), "ORG"),
generator.PrefixedRandomName(cfg.GetNamePrefix(), "QUOTA"),
quotaLimit,
false,
cfg.GetScaledTimeout(1*time.Minute),
commandstarter.NewCommandStarter(),
)
}
示例3: pushApp
func pushApp() string {
appName := generator.PrefixedRandomName("LATS-App-")
appPush := cf.Cf("push", appName, "-p", "assets/dora").Wait(60 * time.Second)
Expect(appPush).To(gexec.Exit(0))
return appName
}
示例4: createServiceInstance
func createServiceInstance(serviceName string) string {
serviceInstanceName := generator.PrefixedRandomName("RATS-SERVICE-")
session := cf.Cf("create-service", serviceName, "fake-plan", serviceInstanceName)
Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))
return serviceInstanceName
}
示例5: NewBaseTestSuiteSetup
func NewBaseTestSuiteSetup(config testSuiteConfig, testSpace, testUser remoteResource, regularUserContext, adminUserContext UserContext) *ReproducibleTestSuiteSetup {
shortTimeout := config.GetScaledTimeout(1 * time.Minute)
return &ReproducibleTestSuiteSetup{
shortTimeout: shortTimeout,
longTimeout: config.GetScaledTimeout(5 * time.Minute),
organizationName: generator.PrefixedRandomName(config.GetNamePrefix(), "ORG"),
spaceName: generator.PrefixedRandomName(config.GetNamePrefix(), "SPACE"),
regularUserContext: regularUserContext,
adminUserContext: adminUserContext,
isPersistent: false,
TestSpace: testSpace,
TestUser: testUser,
}
}
示例6: createServiceBroker
func createServiceBroker() (string, string, string) {
serviceBrokerAsset := assets.NewAssets().ServiceBroker
serviceBrokerAppName := PushApp(serviceBrokerAsset, config.RubyBuildpackName)
serviceName := initiateBrokerConfig(serviceBrokerAppName)
brokerName := generator.PrefixedRandomName("RATS-BROKER-")
brokerUrl := helpers.AppUri(serviceBrokerAppName, "")
config = helpers.LoadConfig()
context := helpers.NewContext(config)
cf.AsUser(context.AdminUserContext(), context.ShortTimeout(), func() {
session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl)
Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))
session = cf.Cf("enable-service-access", serviceName)
Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0))
})
return brokerName, serviceBrokerAppName, serviceName
}
示例7:
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("package features", func() {
var (
appName string
appGuid string
packageGuid string
spaceGuid string
destinationAppGuid string
)
BeforeEach(func() {
appName = generator.PrefixedRandomName("CATS-APP-")
spaceGuid = GetSpaceGuidFromName(context.RegularUserContext().Space)
appGuid = CreateApp(appName, spaceGuid, "{}")
packageGuid = CreatePackage(appGuid)
token := GetAuthToken()
uploadUrl := fmt.Sprintf("%s/v3/packages/%s/upload", config.ApiEndpoint, packageGuid)
UploadPackage(uploadUrl, assets.NewAssets().DoraZip, token)
WaitForPackageToBeReady(packageGuid)
})
AfterEach(func() {
app_helpers.AppReport(appName, DEFAULT_TIMEOUT)
DeleteApp(appGuid)
if destinationAppGuid != "" {
DeleteApp(destinationAppGuid)
}
示例8:
"github.com/cloudfoundry-incubator/cf-test-helpers/runner"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("Recursive Delete", func() {
var broker ServiceBroker
var orgName string
var quotaName string
BeforeEach(func() {
broker = NewServiceBroker(
generator.PrefixedRandomName("rec-del"),
assets.NewAssets().ServiceBroker,
context,
)
broker.Push()
broker.Configure()
broker.Create()
broker.PublicizePlans()
orgName = generator.PrefixedRandomName("rec-del")
quotaName = generator.PrefixedRandomName("rec-del")
spaceName := generator.PrefixedRandomName("rec-del")
appName := generator.PrefixedRandomName("rec-del")
instanceName := generator.PrefixedRandomName("rec-del")
cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() {
示例9:
runner.NewCmdRunner(curlCmd, DEFAULT_TIMEOUT).Run()
Expect(string(curlCmd.Err.Contents())).To(HaveLen(0))
return string(curlCmd.Out.Contents())
}
BeforeEach(func() {
orgName = context.RegularUserContext().Org
spaceName = context.RegularUserContext().Space
domainName = generator.RandomName() + "." + helpers.LoadConfig().AppsDomain
cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() {
Expect(cf.Cf("create-shared-domain", domainName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
})
appNameDora = generator.PrefixedRandomName("CATS-APP-")
Expect(cf.Cf("push", appNameDora, "-m", "128M", "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
appNameSimple = generator.PrefixedRandomName("CATS-APP-")
Expect(cf.Cf("push", appNameSimple, "-m", "128M", "-p", assets.NewAssets().HelloWorld, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
})
AfterEach(func() {
cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() {
Expect(cf.Cf("target", "-o", orgName).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
Expect(cf.Cf("delete-shared-domain", domainName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
})
Expect(cf.Cf("delete", appNameDora, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
Expect(cf.Cf("delete", appNameSimple, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0))
})
示例10:
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
. "github.com/cloudfoundry/cf-acceptance-tests/helpers/services"
)
var _ = Describe("Service Broker Lifecycle", func() {
var broker ServiceBroker
Describe("public brokers", func() {
var acls *Session
var output []byte
var oldServiceName string
var oldPlanName string
BeforeEach(func() {
broker = NewServiceBroker(
generator.PrefixedRandomName("pblc-brkr-"),
assets.NewAssets().ServiceBroker,
context,
)
cf.TargetSpace(context.RegularUserContext(), context.ShortTimeout())
broker.Push()
broker.Configure()
cf.AsUser(context.AdminUserContext(), context.ShortTimeout(), func() {
broker.Create()
})
})
Describe("Updating the catalog", func() {
BeforeEach(func() {
示例11:
package verification_test
import (
. "github.com/cloudfoundry-incubator/bits-service-migration-tests/helpers"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/generator"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("Buildpacks", func() {
var appName string
BeforeEach(func() {
appName = generator.PrefixedRandomName("BSMT-APP-")
})
AfterEach(func() {
Expect(cf.Cf("delete", appName, "-f", "-r").Wait(defaultTimeout)).To(Exit(0))
})
It("uses a previously uploaded buildpack", func() {
Expect(cf.Cf("push", appName, "--no-start", "-b", BuildpackName, "-p", TestAppPath, "-d", config.AppsDomain).Wait(defaultTimeout)).To(Exit(0))
SetBackend(appName)
Expect(cf.Cf("start", appName).Wait(cfPushTimeout)).To(Exit(0))
})
})
示例12:
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/generator"
"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
)
var _ = Describe("The Elasticsearch service", func() {
Describe("adding elasticsearch to an app", func() {
var (
appName string
)
BeforeEach(func() {
appName = generator.PrefixedRandomName("CATS-APP-")
Expect(cf.Cf(
"push", appName,
"--no-start",
"-b", config.GoBuildpackName,
"-p", "../example_apps/es_test_app",
"-d", config.AppsDomain,
).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
})
It("can be added to an app", func() {
instanceName := generator.PrefixedRandomName("ES-SERVICE-")
Expect(cf.Cf("create-service", "elasticsearch13", "free", instanceName).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
Expect(cf.Cf("bind-service", appName, instanceName).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
Expect(cf.Cf("start", appName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
示例13:
Expect(plans.Out.Contents()).To(ContainSubstring("M-HA-dedicated-9.5"))
Expect(plans.Out.Contents()).To(ContainSubstring("L-dedicated-9.5"))
Expect(plans.Out.Contents()).To(ContainSubstring("L-HA-dedicated-9.5"))
})
Context("creating a database instance", func() {
// Avoid creating additional tests in this block because this setup and teardown is
// slow (several minutes).
var (
appName string
dbInstanceName string
rdsInstanceName string
)
BeforeEach(func() {
appName = generator.PrefixedRandomName("CATS-APP-")
dbInstanceName = generator.PrefixedRandomName("test-db-")
Expect(cf.Cf("create-service", serviceName, testPlanName, dbInstanceName).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
pollForRDSCreationCompletion(dbInstanceName)
rdsInstanceName = getRDSInstanceName(dbInstanceName)
fmt.Fprintf(GinkgoWriter, "Created RDS instance: %s\n", rdsInstanceName)
Expect(cf.Cf(
"push", appName,
"--no-start",
"-b", config.GoBuildpackName,
"-p", "../../example-apps/healthcheck",
"-f", "../../example-apps/healthcheck/manifest.yml",
"-d", config.AppsDomain,
示例14: PushAppNoStart
func PushAppNoStart(asset, buildpackName string) string {
app := generator.PrefixedRandomName("RATS-APP-")
Expect(cf.Cf("push", app, "-b", buildpackName, "--no-start", "-m", DEFAULT_MEMORY_LIMIT, "-p", asset, "-d", config.AppsDomain).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
return app
}
示例15:
}
waitForAsyncOperationToComplete := func(broker ServiceBroker, instanceName string) {
Eventually(func() *Session {
serviceDetails := cf.Cf("service", instanceName).Wait(DEFAULT_TIMEOUT)
Expect(serviceDetails).To(Exit(0), "failed getting service instance details")
return serviceDetails
}, ASYNC_OPERATION_TIMEOUT, ASYNC_OPERATION_POLL_INTERVAL).Should(Say("succeeded"))
}
type Params struct{ Param1 string }
Context("Synchronous operations", func() {
BeforeEach(func() {
broker = NewServiceBroker(
generator.PrefixedRandomName("pblc-brkr-"),
assets.NewAssets().ServiceBroker,
context,
)
broker.Push()
broker.Configure()
broker.Create()
broker.PublicizePlans()
})
AfterEach(func() {
app_helpers.AppReport(broker.Name, DEFAULT_TIMEOUT)
broker.Destroy()
})