当前位置: 首页>>代码示例>>Golang>>正文


Golang random_name.CATSRandomName函数代码示例

本文整理汇总了Golang中github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name.CATSRandomName函数的典型用法代码示例。如果您正苦于以下问题:Golang CATSRandomName函数的具体用法?Golang CATSRandomName怎么用?Golang CATSRandomName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CATSRandomName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: initiateBrokerConfig

func initiateBrokerConfig(serviceName, serviceBrokerAppName string) {
	brokerConfigJson := helpers.CurlApp(Config, serviceBrokerAppName, "/config")

	var brokerConfigMap customMap

	err := json.Unmarshal([]byte(brokerConfigJson), &brokerConfigMap)
	Expect(err).NotTo(HaveOccurred())

	dashboardClientId := random_name.CATSRandomName("DASHBOARD-ID")
	serviceId := random_name.CATSRandomName("SVC-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 := random_name.CATSRandomName(fmt.Sprintf("SVC-PLAN-ID-%d-", i))
		plan.(map[string]interface{})["id"] = servicePlanId
	}

	changedJson, err := json.Marshal(brokerConfigMap)
	Expect(err).NotTo(HaveOccurred())

	helpers.CurlApp(Config, serviceBrokerAppName, "/config", "-X", "POST", "-d", string(changedJson))
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:29,代码来源:route_services.go

示例2: AuthenticateUser

func AuthenticateUser(authorizationEndpoint string, username string, password string) (cookie string) {
	loginCsrfUri := fmt.Sprintf("%v/login", authorizationEndpoint)

	cookieFile, err := ioutil.TempFile("", random_name.CATSRandomName("CATS-CSRF-COOKIE"))
	Expect(err).ToNot(HaveOccurred())
	cookiePath := cookieFile.Name()
	defer func() {
		cookieFile.Close()
		os.Remove(cookiePath)
	}()

	curl := helpers.Curl(Config, loginCsrfUri, `--insecure`, `-i`, `-v`, `-c`, cookiePath).Wait(Config.DefaultTimeoutDuration())
	apiResponse := string(curl.Out.Contents())
	csrfRegEx, _ := regexp.Compile(`name="X-Uaa-Csrf" value="(.*)"`)
	csrfToken := csrfRegEx.FindStringSubmatch(apiResponse)[1]

	loginUri := fmt.Sprintf("%v/login.do", authorizationEndpoint)
	usernameEncoded := url.QueryEscape(username)
	passwordEncoded := url.QueryEscape(password)
	csrfTokenEncoded := url.QueryEscape(csrfToken)
	loginCredentials := fmt.Sprintf("username=%v&password=%v&X-Uaa-Csrf=%v", usernameEncoded, passwordEncoded, csrfTokenEncoded)

	curl = helpers.Curl(Config, loginUri, `--data`, loginCredentials, `--insecure`, `-i`, `-v`, `-b`, cookiePath).Wait(Config.DefaultTimeoutDuration())
	Expect(curl).To(Exit(0))
	apiResponse = string(curl.Out.Contents())

	jsessionRegEx, _ := regexp.Compile(`JSESSIONID([^;]*)`)
	vcapidRegEx, _ := regexp.Compile(`__VCAP_ID__([^;]*)`)
	sessionId := jsessionRegEx.FindString(apiResponse)
	vcapId := vcapidRegEx.FindString(apiResponse)
	cookie = fmt.Sprintf("%v;%v", sessionId, vcapId)
	return
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:33,代码来源:sso.go

示例3: createDummyBuildpack

func createDummyBuildpack() string {
	buildpack := random_name.CATSRandomName("BPK")
	buildpackZip := assets.NewAssets().SecurityGroupBuildpack

	workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
		Expect(cf.Cf("create-buildpack", buildpack, buildpackZip, "999").Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
	})
	return buildpack
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:9,代码来源:running_security_groups.go

示例4: createSecurityGroup

func createSecurityGroup(allowedDestinations ...Destination) string {
	file, _ := ioutil.TempFile(os.TempDir(), "CATS-sg-rules")
	defer os.Remove(file.Name())
	Expect(json.NewEncoder(file).Encode(allowedDestinations)).To(Succeed())

	rulesPath := file.Name()
	securityGroupName := random_name.CATSRandomName("SG")

	workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
		Expect(cf.Cf("create-security-group", securityGroupName, rulesPath).Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
	})

	return securityGroupName
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:14,代码来源:running_security_groups.go

示例5:

	. "github.com/cloudfoundry/cf-acceptance-tests/helpers/services"
)

var _ = ServicesDescribe("Purging service offerings", func() {
	var broker ServiceBroker
	var appName, instanceName, asyncInstanceName string

	AfterEach(func() {
		app_helpers.AppReport(broker.Name, Config.DefaultTimeoutDuration())
		broker.Destroy()
	})

	Context("for public brokers", func() {
		BeforeEach(func() {
			broker = NewServiceBroker(
				random_name.CATSRandomName("BRKR"),
				assets.NewAssets().ServiceBroker,
				TestSetup,
			)
			broker.Push(Config)
			broker.Configure()
			workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
				broker.Create()
				broker.PublicizePlans()
			})
			appName = random_name.CATSRandomName("APP")
			instanceName = random_name.CATSRandomName("SVIN")
			asyncInstanceName = random_name.CATSRandomName("SVIN")
		})

		AfterEach(func() {
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:purge_service_offering.go

示例6:

	. "github.com/onsi/gomega/gexec"

	"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
	"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
	"github.com/cloudfoundry/cf-acceptance-tests/helpers/v3_helpers"
)

var _ = AppsDescribe("Uploading and Downloading droplets", func() {
	var helloWorldAppName string
	var out bytes.Buffer

	BeforeEach(func() {
		helloWorldAppName = random_name.CATSRandomName("APP")

		Expect(cf.Cf("push", helloWorldAppName, "--no-start", "-b", Config.GetRubyBuildpackName(), "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().HelloWorld, "-d", Config.GetAppsDomain()).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
		app_helpers.SetBackend(helloWorldAppName)
		Expect(cf.Cf("start", helloWorldAppName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
	})

	AfterEach(func() {
		app_helpers.AppReport(helloWorldAppName, Config.DefaultTimeoutDuration())

		Expect(cf.Cf("delete", helloWorldAppName, "-f", "-r").Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
	})

	It("Users can manage droplet bits for an app", func() {
		By("Downloading the droplet for the app")
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:30,代码来源:droplet_uploading_and_downloading.go

示例7:

	. "github.com/onsi/gomega"
	. "github.com/onsi/gomega/gbytes"
	. "github.com/onsi/gomega/gexec"
)

var _ = AppsDescribe("Logging", func() {
	var logWriterAppName string
	var listenerAppName string
	var logs *Session
	var interrupt chan struct{}
	var serviceName string

	Describe("Syslog drains", func() {
		BeforeEach(func() {
			interrupt = make(chan struct{}, 1)
			serviceName = random_name.CATSRandomName("SVIN")
			listenerAppName = random_name.CATSRandomName("APP")
			logWriterAppName = random_name.CATSRandomName("APP")

			Eventually(cf.Cf("push", listenerAppName, "--no-start", "--health-check-type", "port", "-b", Config.GetGoBuildpackName(), "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().SyslogDrainListener, "-d", Config.GetAppsDomain(), "-f", assets.NewAssets().SyslogDrainListener+"/manifest.yml"), Config.DefaultTimeoutDuration()).Should(Exit(0), "Failed to push app")
			Eventually(cf.Cf("push", logWriterAppName, "--no-start", "-b", Config.GetRubyBuildpackName(), "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().RubySimple, "-d", Config.GetAppsDomain()), Config.DefaultTimeoutDuration()).Should(Exit(0), "Failed to push app")

			app_helpers.SetBackend(listenerAppName)
			app_helpers.SetBackend(logWriterAppName)

			Expect(cf.Cf("start", listenerAppName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
			Expect(cf.Cf("start", logWriterAppName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
		})

		AfterEach(func() {
			logs.Kill()
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:syslog_drain.go

示例8:

var _ = RoutingDescribe("Context Paths", func() {
	var (
		app1              string
		helloRoutingAsset = assets.NewAssets().HelloRouting

		app2     string
		app2Path = "/app2"
		app3     string
		app3Path = "/app3/long/sub/path"
		hostname string
	)

	BeforeEach(func() {
		domain := Config.GetAppsDomain()

		app1 = random_name.CATSRandomName("APP")
		PushApp(app1, helloRoutingAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT)
		app2 = random_name.CATSRandomName("APP")
		PushApp(app2, helloRoutingAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT)
		app3 = random_name.CATSRandomName("APP")
		PushApp(app3, helloRoutingAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT)

		hostname = app1

		MapRouteToApp(app2, domain, hostname, app2Path, Config.DefaultTimeoutDuration())
		MapRouteToApp(app3, domain, hostname, app3Path, Config.DefaultTimeoutDuration())
	})

	AfterEach(func() {
		AppReport(app1, Config.DefaultTimeoutDuration())
		AppReport(app2, Config.DefaultTimeoutDuration())
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:context_paths.go

示例9:

	var revertExtendedEnv = func(groupType, envVarName string) {
		envMap := fetchEnvironmentVariables(groupType)
		delete(envMap, envVarName)
		jsonObj := marshalUpdatedEnv(envMap)

		apiUrl := fmt.Sprintf("/v2/config/environment_variable_groups/%s", groupType)
		Expect(cf.Cf("curl", apiUrl, "-X", "PUT", "-d", string(jsonObj)).Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
	}

	Context("Staging environment variable groups", func() {
		var appName string
		var buildpackName string
		var envVarName string

		BeforeEach(func() {
			appName = random_name.CATSRandomName("APP")
			envVarName = fmt.Sprintf("CATS_STAGING_TEST_VAR_%s", strconv.Itoa(int(time.Now().UnixNano())))
		})

		AfterEach(func() {
			app_helpers.AppReport(appName, Config.DefaultTimeoutDuration())

			workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
				revertExtendedEnv("staging", envVarName)
				if buildpackName != "" {
					Expect(cf.Cf("delete-buildpack", buildpackName, "-f").Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
				}
			})

			Expect(cf.Cf("delete", appName, "-f", "-r").Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
		})
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:environment_variables_group.go

示例10:

	"github.com/cloudfoundry/cf-acceptance-tests/helpers/skip_messages"
)

var _ = ServicesDescribe("SSO Lifecycle", func() {
	var broker ServiceBroker
	var oauthConfig OAuthConfig
	var apiEndpoint string

	redirectUri := `http://example.com`

	BeforeEach(func() {
		if !Config.GetIncludeSSO() {
			Skip(skip_messages.SkipSSOMessage)
		}
		broker = NewServiceBroker(
			random_name.CATSRandomName("BRKR"),
			assets.NewAssets().ServiceBroker,
			TestSetup,
		)
		broker.Push(Config)
		broker.Service.DashboardClient.RedirectUri = redirectUri
		broker.Configure()

		oauthConfig = OAuthConfig{}
		oauthConfig.ClientId = broker.Service.DashboardClient.ID
		oauthConfig.ClientSecret = broker.Service.DashboardClient.Secret
		oauthConfig.RedirectUri = redirectUri
		oauthConfig.RequestedScopes = `openid,cloud_controller_service_permissions.read`

		apiEndpoint = Config.Protocol() + Config.GetApiEndpoint()
		SetOauthEndpoints(apiEndpoint, &oauthConfig, Config)
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:sso_lifecycle.go

示例11:

	}

	waitForAsyncOperationToComplete := func(broker ServiceBroker, instanceName string) {
		Eventually(func() *Session {
			serviceDetails := cf.Cf("service", instanceName).Wait(Config.DefaultTimeoutDuration())
			Expect(serviceDetails).To(Exit(0), "failed getting service instance details")
			return serviceDetails
		}, Config.AsyncServiceOperationTimeoutDuration(), ASYNC_OPERATION_POLL_INTERVAL).Should(Say("succeeded"))
	}

	type Params struct{ Param1 string }

	Context("Synchronous operations", func() {
		BeforeEach(func() {
			broker = NewServiceBroker(
				random_name.CATSRandomName("BRKR"),
				assets.NewAssets().ServiceBroker,
				TestSetup,
			)
			broker.Push(Config)
			broker.Configure()
			broker.Create()
			broker.PublicizePlans()
		})

		AfterEach(func() {
			app_helpers.AppReport(broker.Name, Config.DefaultTimeoutDuration())

			broker.Destroy()
		})
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:30,代码来源:service_instance_lifecycle.go

示例12:

	"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
	. "github.com/cloudfoundry/cf-acceptance-tests/helpers/services"
)

var _ = ServicesDescribe("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(
				random_name.CATSRandomName("BRKR"),
				assets.NewAssets().ServiceBroker,
				TestSetup,
			)
			TestSetup.RegularUserContext().TargetSpace()
			broker.Push(Config)
			broker.Configure()

			workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() {
				broker.Create()
			})
		})

		Describe("Updating the catalog", func() {
			BeforeEach(func() {
				broker.PublicizePlans()
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:service_broker_lifecycle.go

示例13: NewServiceBroker

func NewServiceBroker(name string, path string, TestSetup *workflowhelpers.ReproducibleTestSuiteSetup) ServiceBroker {
	b := ServiceBroker{}
	b.Path = path
	b.Name = name
	b.Service.Name = random_name.CATSRandomName("SVC")
	b.Service.ID = random_name.CATSRandomName("SVC-ID")
	b.SyncPlans = []Plan{
		{Name: random_name.CATSRandomName("SVC-PLAN"), ID: random_name.CATSRandomName("SVC-PLAN-ID")},
		{Name: random_name.CATSRandomName("SVC-PLAN"), ID: random_name.CATSRandomName("SVC-PLAN-ID")},
	}
	b.AsyncPlans = []Plan{
		{Name: random_name.CATSRandomName("SVC-PLAN"), ID: random_name.CATSRandomName("SVC-PLAN-ID")},
		{Name: random_name.CATSRandomName("SVC-PLAN"), ID: random_name.CATSRandomName("SVC-PLAN-ID")},
	}
	b.Service.DashboardClient.ID = random_name.CATSRandomName("DASHBOARD-ID")
	b.Service.DashboardClient.Secret = random_name.CATSRandomName("DASHBOARD-SECRET")
	b.Service.DashboardClient.RedirectUri = random_name.CATSRandomName("DASHBOARD-URI")
	b.TestSetup = TestSetup
	return b
}
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:20,代码来源:broker.go

示例14:

		}
	})

	Context("when a route binds to a service", func() {
		Context("when service broker returns a route service url", func() {
			var (
				serviceInstanceName      string
				brokerName               string
				appName                  string
				routeServiceName         string
				golangAsset              = assets.NewAssets().Golang
				loggingRouteServiceAsset = assets.NewAssets().LoggingRouteService
			)

			BeforeEach(func() {
				routeServiceName = random_name.CATSRandomName("APP")
				brokerName = random_name.CATSRandomName("BRKR")
				serviceInstanceName = random_name.CATSRandomName("SVIN")
				appName = random_name.CATSRandomName("APP")

				serviceName := random_name.CATSRandomName("SVC")
				brokerAppName := random_name.CATSRandomName("APP")

				createServiceBroker(brokerName, brokerAppName, serviceName)
				createServiceInstance(serviceInstanceName, serviceName)

				PushAppNoStart(appName, golangAsset, Config.GetGoBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT)
				EnableDiego(appName, Config.DefaultTimeoutDuration())
				StartApp(appName, Config.CfPushTimeoutDuration())

				PushApp(routeServiceName, loggingRouteServiceAsset, Config.GetGoBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT)
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:route_services.go

示例15: getStagingOutput

}

func getStagingOutput(appName string) func() *Session {
	return func() *Session {
		appLogsSession := cf.Cf("logs", "--recent", appName)
		Expect(appLogsSession.Wait(Config.DefaultTimeoutDuration())).To(Exit(0))
		return appLogsSession
	}
}

var _ = SecurityGroupsDescribe("Security Groups", func() {
	var serverAppName, privateHost string
	var privatePort int

	BeforeEach(func() {
		serverAppName = random_name.CATSRandomName("APP")
		pushApp(serverAppName, Config.GetRubyBuildpackName())
		Expect(cf.Cf("start", serverAppName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))

		privateHost, privatePort = getAppHostIpAndPort(serverAppName)
	})

	Describe("Running security-groups", func() {
		var clientAppName, securityGroupName string

		BeforeEach(func() {
			clientAppName = random_name.CATSRandomName("APP")
			pushApp(clientAppName, Config.GetRubyBuildpackName())
			Expect(cf.Cf("start", clientAppName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))

			By("Asserting default running security group configuration for traffic between containers")
开发者ID:nickwei84,项目名称:cf-acceptance-tests,代码行数:31,代码来源:running_security_groups.go


注:本文中的github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name.CATSRandomName函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。