示例#1
0
文件: push_test.go 项目: nota-ja/cli
	Describe("re-pushing an existing app", func() {
		var existingApp models.Application

		BeforeEach(func() {
			existingApp = models.Application{}
			existingApp.Name = "existing-app"
			existingApp.Guid = "existing-app-guid"
			existingApp.Command = "unicorn -c config/unicorn.rb -D"
			existingApp.EnvironmentVars = map[string]string{
				"crazy": "pants",
				"FOO":   "NotYoBaz",
				"foo":   "manchu",
			}

			appRepo.ReadReturns.App = existingApp
			appRepo.UpdateAppResult = existingApp
		})

		It("resets the app's buildpack when the -b flag is provided as 'default'", func() {
			callPush("-b", "default", "existing-app")
			Expect(*appRepo.UpdateParams.BuildpackUrl).To(Equal(""))
		})

		It("resets the app's command when the -c flag is provided as 'default'", func() {
			callPush("-c", "default", "existing-app")
			Expect(*appRepo.UpdateParams.Command).To(Equal(""))
		})

		It("resets the app's buildpack when the -b flag is provided as 'null'", func() {
			callPush("-b", "null", "existing-app")
			Expect(*appRepo.UpdateParams.BuildpackUrl).To(Equal(""))
示例#2
0
	It("fails when given an invalid memory limit", func() {
		appRepo.ReadNotFound = true

		callPush("-m", "abcM", "my-new-app")

		testassert.SliceContains(ui.Outputs, testassert.Lines{
			{"FAILED"},
			{"invalid", "memory"},
		})
	})

	It("stops the app, achieving a full-downtime deploy!", func() {
		existingApp := maker.NewApp(maker.Overrides{"name": "existing-app"})
		appRepo.ReadApp = existingApp
		appRepo.UpdateAppResult = existingApp

		callPush("existing-app")

		Expect(stopper.AppToStop.Guid).To(Equal(existingApp.Guid))
		Expect(appBitsRepo.UploadedAppGuid).To(Equal(existingApp.Guid))
	})

	It("does not stop the app when it is already stopped", func() {
		stoppedApp := maker.NewApp(maker.Overrides{"state": "stopped", "name": "stopped-app"})

		appRepo.ReadApp = stoppedApp
		appRepo.UpdateAppResult = stoppedApp

		callPush("stopped-app")
示例#3
0
			testcmd.RunCommand(cmd, testcmd.NewContext("scale", []string{"my-app"}), reqFactory)

			Expect(testcmd.CommandDidPassRequirements).To(BeTrue())
		})
	})

	Describe("scaling an app", func() {
		BeforeEach(func() {
			app := maker.NewApp(maker.Overrides{"name": "my-app", "guid": "my-app-guid"})
			app.InstanceCount = 42
			app.DiskQuota = 1024
			app.Memory = 256

			reqFactory.Application = app
			appRepo.UpdateAppResult = app
		})

		Context("when no flags are specified", func() {
			It("prints a description of the app's limits", func() {
				testcmd.RunCommand(cmd, testcmd.NewContext("scale", []string{"my-app"}), reqFactory)

				testassert.SliceContains(ui.Outputs, testassert.Lines{
					{"Showing", "my-app", "my-org", "my-space", "my-user"},
					{"OK"},
					{"memory", "256M"},
					{"disk", "1G"},
					{"instances", "42"},
				})

				testassert.SliceDoesNotContain(ui.Outputs, testassert.Lines{