當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。