本文整理汇总了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, ","),