github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/push/multiple_apps_in_manifest_test.go (about)

     1  package push
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"code.cloudfoundry.org/cli/integration/helpers"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  	. "github.com/onsi/gomega/gbytes"
    11  	. "github.com/onsi/gomega/gexec"
    12  )
    13  
    14  var _ = Describe("pushes multiple apps with a single manifest file", func() {
    15  	var (
    16  		firstApp  string
    17  		secondApp string
    18  	)
    19  
    20  	BeforeEach(func() {
    21  		firstApp = helpers.NewAppName()
    22  		secondApp = helpers.NewAppName()
    23  	})
    24  
    25  	Context("when the apps are new", func() {
    26  		Context("with no global properties", func() {
    27  			It("pushes multiple apps with a single push", func() {
    28  				helpers.WithHelloWorldApp(func(dir string) {
    29  					helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
    30  						"applications": []map[string]string{
    31  							{
    32  								"name": firstApp,
    33  							},
    34  							{
    35  								"name": secondApp,
    36  							},
    37  						},
    38  					})
    39  
    40  					session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName)
    41  					Eventually(session).Should(Say("Getting app info\\.\\.\\."))
    42  
    43  					// firstApp
    44  					Eventually(session).Should(Say("Creating app with these attributes\\.\\.\\."))
    45  					Eventually(session).Should(Say("\\+\\s+name:\\s+%s", firstApp))
    46  					Eventually(session).Should(Say("\\s+routes:"))
    47  					Eventually(session).Should(Say("(?i)\\+\\s+%s.%s", firstApp, defaultSharedDomain()))
    48  
    49  					// secondApp
    50  					Eventually(session).Should(Say("Creating app with these attributes\\.\\.\\."))
    51  					Eventually(session).Should(Say("\\+\\s+name:\\s+%s", secondApp))
    52  					Eventually(session).Should(Say("\\s+routes:"))
    53  					Eventually(session).Should(Say("(?i)\\+\\s+%s.%s", secondApp, defaultSharedDomain()))
    54  
    55  					Eventually(session).Should(Say("Creating app %s\\.\\.\\.", firstApp))
    56  					Eventually(session).Should(Say("Mapping routes\\.\\.\\."))
    57  					Eventually(session).Should(Say("Uploading files\\.\\.\\."))
    58  					Eventually(session).Should(Say("100.00%"))
    59  					Eventually(session).Should(Say("Waiting for API to complete processing files\\.\\.\\."))
    60  					helpers.ConfirmStagingLogs(session)
    61  					Eventually(session).Should(Say("Waiting for app to start\\.\\.\\."))
    62  					Eventually(session).Should(Say("requested state:\\s+started"))
    63  
    64  					Eventually(session).Should(Say("Creating app %s\\.\\.\\.", secondApp))
    65  					Eventually(session).Should(Say("Mapping routes\\.\\.\\."))
    66  					Eventually(session).Should(Say("Uploading files\\.\\.\\."))
    67  					Eventually(session).Should(Say("100.00%"))
    68  					Eventually(session).Should(Say("Waiting for API to complete processing files\\.\\.\\."))
    69  					helpers.ConfirmStagingLogs(session)
    70  					Eventually(session).Should(Say("Waiting for app to start\\.\\.\\."))
    71  					Eventually(session).Should(Say("requested state:\\s+started"))
    72  					Eventually(session).Should(Exit(0))
    73  				})
    74  
    75  				session := helpers.CF("app", firstApp)
    76  				Eventually(session).Should(Say("name:\\s+%s", firstApp))
    77  				Eventually(session).Should(Exit(0))
    78  
    79  				session = helpers.CF("app", secondApp)
    80  				Eventually(session).Should(Say("name:\\s+%s", secondApp))
    81  				Eventually(session).Should(Exit(0))
    82  			})
    83  		})
    84  	})
    85  })