コード例 #1
0
				_, task := fakeBBS.DesireTaskArgsForCall(0)
				Expect(task).To(Equal(expectedTask))
			})

			It("responds with 201 CREATED", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusCreated))
			})

			It("responds with an empty body", func() {
				Expect(responseRecorder.Body.String()).To(Equal(""))
			})

			Context("when env vars are specified", func() {
				BeforeEach(func() {
					validCreateRequest.EnvironmentVariables = []receptor.EnvironmentVariable{
						{Name: "var1", Value: "val1"},
						{Name: "var2", Value: "val2"},
					}
				})

				AfterEach(func() {
					validCreateRequest.EnvironmentVariables = []receptor.EnvironmentVariable{}
				})

				It("passes them to the BBS", func() {
					Expect(fakeBBS.DesireTaskCallCount()).To(Equal(1))
					_, task := fakeBBS.DesireTaskArgsForCall(0)
					Expect(task.EnvironmentVariables).To(Equal([]models.EnvironmentVariable{
						{Name: "var1", Value: "val1"},
						{Name: "var2", Value: "val2"},
					}))
コード例 #2
0
				Expect(def).To(Equal(expectedTask.TaskDefinition))
			})

			It("responds with 201 CREATED", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusCreated))
			})

			It("responds with an empty body", func() {
				Expect(responseRecorder.Body.String()).To(Equal(""))
			})

			Context("when omitempty fields", func() {
				Context("are specified", func() {
					BeforeEach(func() {
						validCreateRequest.EnvironmentVariables = []*models.EnvironmentVariable{
							{Name: "var1", Value: "val1"},
							{Name: "var2", Value: "val2"},
						}
						validCreateRequest.EgressRules = []*models.SecurityGroupRule{
							{Protocol: "tcp"},
						}
					})

					It("passes them to the BBS", func() {
						Expect(fakeClient.DesireTaskCallCount()).To(Equal(1))
						_, _, def := fakeClient.DesireTaskArgsForCall(0)
						Expect(def.EnvironmentVariables).To(Equal([]*models.EnvironmentVariable{
							{Name: "var1", Value: "val1"},
							{Name: "var2", Value: "val2"},
						}))
						Expect(def.EgressRules).To(Equal([]*models.SecurityGroupRule{{Protocol: "tcp"}}))
					})