本文整理匯總了Golang中github.com/cloudfoundry-incubator/runtime-schema/cc_messages.StagingRequestFromCC.Environment方法的典型用法代碼示例。如果您正苦於以下問題:Golang StagingRequestFromCC.Environment方法的具體用法?Golang StagingRequestFromCC.Environment怎麽用?Golang StagingRequestFromCC.Environment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/runtime-schema/cc_messages.StagingRequestFromCC
的用法示例。
在下文中一共展示了StagingRequestFromCC.Environment方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
MemoryMB: 512,
DiskMB: 512,
Timeout: 512,
LifecycleData: &lifecycleData,
EgressRules: []*models.SecurityGroupRule{
{
Protocol: "TCP",
Destinations: []string{"0.0.0.0/0"},
PortRange: &models.PortRange{Start: 80, End: 443},
},
},
}
if dockerImageCachingEnabled {
stagingRequest.Environment = append(stagingRequest.Environment, &models.EnvironmentVariable{
Name: "DIEGO_DOCKER_CACHE",
Value: "true",
})
}
return stagingRequest
}
Context("when docker registry is running", func() {
var dockerDownloadAction = models.EmitProgressFor(
&models.DownloadAction{
From: "http://file-server.com/v1/static/docker_lifecycle/docker_app_lifecycle.tgz",
To: "/tmp/docker_app_lifecycle",
CacheKey: "docker-lifecycle",
User: "vcap",
},
"",
示例2:
})
It("returns an error", func() {
_, _, _, err := docker.BuildRecipe(stagingGuid, stagingRequest)
Expect(err).To(Equal(backend.ErrNoCompilerDefined))
})
})
Context("with invalid docker registry address", func() {
BeforeEach(func() {
config.DockerRegistryAddress = "://host:"
})
JustBeforeEach(func() {
stagingRequest.Environment = []*models.EnvironmentVariable{
{Name: "DIEGO_DOCKER_CACHE", Value: "true"},
}
})
It("returns an error", func() {
_, _, _, err := docker.BuildRecipe(stagingGuid, stagingRequest)
Expect(err).To(Equal(backend.ErrInvalidDockerRegistryAddress))
Expect(logger).To(gbytes.Say(`{"address":"://host:","app-id":"bunny","error":"too many colons in address ://host:"`))
})
})
})
It("creates a cf-app-docker-staging Task with staging instructions", func() {
taskDef, guid, domain, err := docker.BuildRecipe(stagingGuid, stagingRequest)
Expect(err).NotTo(HaveOccurred())
示例3:
It("creates a cf-app-docker-staging Task with no additional egress rules", func() {
taskDef, _, _, err := docker.BuildRecipe(stagingGuid, stagingRequest)
Expect(err).NotTo(HaveOccurred())
Expect(taskDef.EgressRules).To(BeEmpty())
})
})
Context("user opted-in for docker image caching", func() {
modelsCachingVar := &models.EnvironmentVariable{Name: "DIEGO_DOCKER_CACHE", Value: "true"}
var (
internalRunAction models.RunAction
)
JustBeforeEach(func() {
cachingVar := &models.EnvironmentVariable{Name: "DIEGO_DOCKER_CACHE", Value: "true"}
stagingRequest.Environment = append(stagingRequest.Environment, cachingVar)
fileDescriptorLimit := uint64(512)
internalRunAction = models.RunAction{
Path: "/tmp/docker_app_lifecycle/builder",
Args: []string{
"-outputMetadataJSONFilename",
"/tmp/docker-result/result.json",
"-dockerRef",
"busybox",
"-cacheDockerImage",
"-dockerRegistryHost",
dockerRegistryHost,
"-dockerRegistryPort",
fmt.Sprintf("%d", dockerRegistryPort),
"-dockerRegistryIPs",
strings.Join(dockerRegistryIPs, ","),