コード例 #1
0
ファイル: app_runner_test.go プロジェクト: davidwadden/ltc
		})
	})

	Describe("ScaleApp", func() {
		It("scales a Docker App", func() {
			desiredLRPs := []receptor.DesiredLRPResponse{
				{ProcessGuid: "americano-app", Instances: 1},
			}
			fakeReceptorClient.DesiredLRPsReturns(desiredLRPs, nil)
			instanceCount := 25

			err := appRunner.ScaleApp("americano-app", instanceCount)
			Expect(err).NotTo(HaveOccurred())

			Expect(fakeReceptorClient.UpdateDesiredLRPCallCount()).To(Equal(1))
			processGuid, updateRequest := fakeReceptorClient.UpdateDesiredLRPArgsForCall(0)
			Expect(processGuid).To(Equal("americano-app"))
			Expect(*updateRequest.Instances).To(Equal(instanceCount))
		})

		It("returns errors if the app is NOT already started", func() {
			desiredLRPs := []receptor.DesiredLRPResponse{
				{ProcessGuid: "americano-app", Instances: 1},
			}
			fakeReceptorClient.DesiredLRPsReturns(desiredLRPs, nil)

			err := appRunner.ScaleApp("app-not-running", 15)
			Expect(err).To(MatchError("app-not-running is not started."))

			Expect(fakeReceptorClient.DesiredLRPsCallCount()).To(Equal(1))
		})