Esempio n. 1
0
		Describe("BuildStagingResponse", func() {
			var annotationJson []byte
			var stagingResultJson []byte
			var taskResponseFailed bool
			var failureReason string
			var buildError error

			JustBeforeEach(func() {
				taskResponse := &models.TaskCallbackResponse{
					Annotation:    string(annotationJson),
					Failed:        taskResponseFailed,
					FailureReason: failureReason,
					Result:        string(stagingResultJson),
				}

				response, buildError = docker.BuildStagingResponse(taskResponse)
			})

			Context("with a valid annotation", func() {
				BeforeEach(func() {
					annotation := cc_messages.StagingTaskAnnotation{
						Lifecycle: "docker",
					}
					var err error
					annotationJson, err = json.Marshal(annotation)
					Expect(err).NotTo(HaveOccurred())
				})

				Context("with a successful task response", func() {
					BeforeEach(func() {
						taskResponseFailed = false
	})

	Describe("BuildStagingResponse", func() {
		var response cc_messages.StagingResponseForCC
		var stagingResultJson []byte
		var taskResponseFailed bool
		var failureReason string
		var buildError error

		JustBeforeEach(func() {
			taskResponse := &models.TaskCallbackResponse{
				Failed:        taskResponseFailed,
				FailureReason: failureReason,
				Result:        string(stagingResultJson),
			}
			response, buildError = traditional.BuildStagingResponse(taskResponse)
		})

		Context("with a successful task response", func() {
			BeforeEach(func() {
				taskResponseFailed = false
			})

			Context("with a valid staging result", func() {
				BeforeEach(func() {
					stagingResult := buildpack_app_lifecycle.NewStagingResult(
						buildpack_app_lifecycle.ProcessTypes{
							"web": "rm -rf /*",
						},
						buildpack_app_lifecycle.LifecycleMetadata{
							BuildpackKey:      "buildpack-key",