github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/integration/v7/push/push_output_test.go (about)

     1  package push
     2  
     3  import (
     4  	"path/filepath"
     5  	"regexp"
     6  	"time"
     7  
     8  	"code.cloudfoundry.org/cli/integration/helpers"
     9  
    10  	. "github.com/onsi/ginkgo"
    11  	. "github.com/onsi/gomega"
    12  	. "github.com/onsi/gomega/gbytes"
    13  	. "github.com/onsi/gomega/gexec"
    14  )
    15  
    16  var _ = Describe("Output", func() {
    17  	var (
    18  		appName  string
    19  		appName2 string
    20  
    21  		username string
    22  	)
    23  
    24  	BeforeEach(func() {
    25  		appName = helpers.NewAppName()
    26  		appName2 = helpers.NewAppName()
    27  		username, _ = helpers.GetCredentials()
    28  	})
    29  
    30  	When("there is a manifest", func() {
    31  		It("prints the manifests path and other output", func() {
    32  			helpers.WithHelloWorldApp(func(dir string) {
    33  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
    34  					"applications": []map[string]interface{}{
    35  						{"name": appName},
    36  						{"name": appName2},
    37  					},
    38  				})
    39  
    40  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName)
    41  				Eventually(session).Should(Say(`Pushing apps %s, %s to org %s / space %s as %s\.\.\.`, appName, appName2, organization, space, username))
    42  				Eventually(session).Should(helpers.SayPath(`Applying manifest file %s`, filepath.Join(dir, "manifest.yml")))
    43  				Eventually(session).Should(Say(`Uploading files\.\.\.`))
    44  				Eventually(session).Should(Say("100.00%"))
    45  				Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    46  				helpers.ConfirmStagingLogs(session)
    47  				Eventually(session).Should(Say(`Waiting for app %s to start\.\.\.`, appName))
    48  				Eventually(session.Err).Should(Say(`Instances starting\.\.\.`))
    49  				Eventually(session).Should(Say(`requested state:\s+started`))
    50  				Eventually(session).Should(Say(`start command:\s+%s`, regexp.QuoteMeta(helpers.ModernStaticfileBuildpackStartCommand)))
    51  				Eventually(session).Should(Say(`Uploading files\.\.\.`))
    52  				Eventually(session).Should(Say("100.00%"))
    53  				Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    54  				helpers.ConfirmStagingLogs(session)
    55  				Eventually(session).Should(Say(`Waiting for app %s to start\.\.\.`, appName2))
    56  				Eventually(session.Err).Should(Say(`Instances starting\.\.\.`))
    57  				Eventually(session).Should(Say(`requested state:\s+started`))
    58  				Eventually(session).Should(Say(`start command:\s+%s`, regexp.QuoteMeta(helpers.ModernStaticfileBuildpackStartCommand)))
    59  				Eventually(session).Should(Exit(0))
    60  			})
    61  		})
    62  	})
    63  
    64  	When("there is no a manifest", func() {
    65  		It("does not display any manifest information", func() {
    66  			helpers.WithHelloWorldApp(func(dir string) {
    67  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName)
    68  				Consistently(session).ShouldNot(Say(`Applying manifest`))
    69  				Consistently(session, 10*time.Second).ShouldNot(Say(`Manifest applied`))
    70  				Eventually(session).Should(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, username))
    71  				Eventually(session).Should(Say(`Uploading files\.\.\.`))
    72  				Eventually(session).Should(Say("100.00%"))
    73  				Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    74  				helpers.ConfirmStagingLogs(session)
    75  				Eventually(session).Should(Say(`Waiting for app %s to start\.\.\.`, appName))
    76  				Eventually(session.Err).Should(Say(`Instances starting\.\.\.`))
    77  				Eventually(session).Should(Say(`requested state:\s+started`))
    78  				Eventually(session).Should(Say(`start command:\s+%s`, regexp.QuoteMeta(helpers.ModernStaticfileBuildpackStartCommand)))
    79  				Eventually(session).Should(Exit(0))
    80  			})
    81  		})
    82  	})
    83  })