Ejemplo n.º 1
0
func TestLats(t *testing.T) {
	RegisterFailHandler(Fail)

	var environment *helpers.Environment

	BeforeSuite(func() {
		config = helpers.LoadConfig()

		context := helpers.NewContext(config)
		environment = helpers.NewEnvironment(context)

		environment.Setup()
	})

	AfterSuite(func() {
		environment.Teardown()
	})

	RunSpecs(t, "Lats Suite")
}
var _ = Describe("An application that's already been pushed", func() {
	var appName string
	config := helpers.LoadConfig()
	var environment *helpers.Environment

	BeforeEach(func() {
		persistentContext := helpers.NewPersistentAppContext(config)
		environment = helpers.NewEnvironment(persistentContext)
		environment.Setup()
	})

	AfterEach(func() {
		app_helpers.AppReport(appName, DEFAULT_TIMEOUT)

		environment.Teardown()
	})

	BeforeEach(func() {
		appName = config.PersistentAppHost

		appQuery := cf.Cf("app", appName).Wait(DEFAULT_TIMEOUT)
		// might exit with 1 or 0, depending on app status
		output := string(appQuery.Out.Contents())

		if appQuery.ExitCode() == 1 && strings.Contains(output, "not found") {
			pushCommand := cf.Cf("push", appName, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(DEFAULT_TIMEOUT)
			if pushCommand.ExitCode() != 0 {
				Expect(cf.Cf("delete", "-f", "-r", appName).Wait(DEFAULT_TIMEOUT)).To(Exit(0))
				Fail("failed to create app")
			}