Пример #1
0
			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:     "******",
			},
			"",
Пример #2
0
			})

			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
0
			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, ","),