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


Golang StagingRequestFromCC.Environment方法代码示例

本文整理汇总了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",
			},
			"",
开发者ID:emc-xchallenge,项目名称:stager,代码行数:32,代码来源:docker_registry_test.go

示例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())
开发者ID:guanglinlv,项目名称:stager,代码行数:31,代码来源:docker_backend_test.go

示例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, ","),
开发者ID:guanglinlv,项目名称:stager,代码行数:31,代码来源:docker_registry_test.go


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