It("sets a default FD limit on the run action", func() {
				parallelRunAction := desiredLRP.Action.CodependentAction
				Expect(parallelRunAction.Actions).To(HaveLen(1))

				runAction := parallelRunAction.Actions[0].RunAction

				Expect(runAction.ResourceLimits.Nofile).NotTo(BeNil())
				Expect(*runAction.ResourceLimits.Nofile).To(Equal(recipebuilder.DefaultFileDescriptorLimit))
			})
		})
	})

	Context("BuildTask", func() {
		var (
			taskRequest    *cc_messages.TaskRequestFromCC
			taskDefinition *models.TaskDefinition
			err            error
		)

		BeforeEach(func() {
			taskRequest = &cc_messages.TaskRequestFromCC{
				LogGuid:     "the-log-guid",
				DiskMb:      128,
				MemoryMb:    512,
				EgressRules: egressRules,
				EnvironmentVariables: []*models.EnvironmentVariable{
					{Name: "foo", Value: "bar"},
				},
				CompletionCallbackUrl: "http://google.com",
				Command:               "docker run fast",
				DockerPath:            "cloudfoundry/diego-docker-app",
			})
		})

		Context("when desired app request does not have any ports specified", func() {
			It("returns the slice with default port", func() {
				ports, err := builder.ExtractExposedPorts(&desiredAppReq)
				Expect(err).ToNot(HaveOccurred())
				Expect(ports).To(Equal([]uint32{8080}))
			})
		})
	})

	Describe("BuildTask", func() {
		var (
			err            error
			newTaskReq     cc_messages.TaskRequestFromCC
			taskDefinition *models.TaskDefinition
		)

		BeforeEach(func() {
			newTaskReq = cc_messages.TaskRequestFromCC{
				LogGuid:   "some-log-guid",
				MemoryMb:  128,
				DiskMb:    512,
				Lifecycle: "docker",
				EnvironmentVariables: []*models.EnvironmentVariable{
					{Name: "foo", Value: "bar"},
					{Name: "VCAP_APPLICATION", Value: "{\"application_name\":\"my-app\"}"},
				},
				DropletUri:            "http://the-droplet.uri.com",
				RootFs:                "some-stack",
Пример #3
0
	"github.com/cloudfoundry-incubator/nsync/handlers"
	"github.com/cloudfoundry-incubator/nsync/recipebuilder"
	"github.com/cloudfoundry-incubator/runtime-schema/cc_messages"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("DesireTaskHandler", func() {
	var (
		logger           *lagertest.TestLogger
		fakeBBSClient    *fake_bbs.FakeClient
		buildpackBuilder *fakes.FakeRecipeBuilder
		taskRequest      cc_messages.TaskRequestFromCC

		request          *http.Request
		responseRecorder *httptest.ResponseRecorder
	)

	BeforeEach(func() {
		var err error

		logger = lagertest.NewTestLogger("test")
		fakeBBSClient = new(fake_bbs.FakeClient)
		buildpackBuilder = new(fakes.FakeRecipeBuilder)

		taskRequest = cc_messages.TaskRequestFromCC{
			TaskGuid:  "the-task-guid",
			LogGuid:   "some-log-guid",