github.com/loafoe/cli@v7.1.0+incompatible/integration/v6/push/app_flags_test.go (about)

     1  package push
     2  
     3  import (
     4  	"fmt"
     5  	"regexp"
     6  	"time"
     7  
     8  	"code.cloudfoundry.org/cli/integration/helpers"
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/gomega"
    11  	. "github.com/onsi/gomega/gbytes"
    12  	. "github.com/onsi/gomega/gexec"
    13  )
    14  
    15  var _ = Describe("push with various flags and no manifest", func() {
    16  	var (
    17  		appName   string
    18  		stackName string
    19  	)
    20  
    21  	BeforeEach(func() {
    22  		appName = helpers.NewAppName()
    23  		stackName = helpers.PreferredStack()
    24  	})
    25  
    26  	It("creates the app with the specified settings, with the health check type", func() {
    27  		helpers.WithHelloWorldApp(func(dir string) {
    28  			session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    29  				PushCommandName, appName,
    30  				"-b", "staticfile_buildpack",
    31  				"-c", fmt.Sprintf("echo 'hi' && %s", helpers.StaticfileBuildpackStartCommand),
    32  				"-u", "port", //works if this stuff is commentted out
    33  				"-k", "300M",
    34  				"-i", "2",
    35  				"-m", "70M",
    36  				"-s", stackName,
    37  				"-t", "180",
    38  			)
    39  			Eventually(session).Should(Say(`Getting app info\.\.\.`))
    40  			Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`))
    41  			Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName))
    42  			Eventually(session).Should(Say(`(?m)\s+buildpacks:\s+\+\s+staticfile_buildpack`))
    43  			Eventually(session).Should(Say(`\s+command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand)))
    44  			Eventually(session).Should(Say(`\s+disk quota:\s+300M`))
    45  			Eventually(session).Should(Say(`\s+health check timeout:\s+180`))
    46  			Eventually(session).Should(Say(`\s+health check type:\s+port`))
    47  			Eventually(session).Should(Say(`\s+instances:\s+2`))
    48  			Eventually(session).Should(Say(`\s+memory:\s+70M`))
    49  			Eventually(session).Should(Say(`\s+stack:\s+%s`, stackName))
    50  			Eventually(session).Should(Say(`\s+routes:`))
    51  			Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain()))
    52  			Eventually(session).Should(Say(`Mapping routes\.\.\.`))
    53  			Eventually(session).Should(Say(`Uploading files\.\.\.`))
    54  			Eventually(session).Should(Say("100.00%"))
    55  			Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    56  			helpers.ConfirmStagingLogs(session)
    57  			Eventually(session).Should(Say(`Waiting for app to start\.\.\.`))
    58  			Eventually(session).Should(Say(`requested state:\s+started`))
    59  			Eventually(session).Should(Say(`start command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand)))
    60  			Eventually(session).Should(Exit(0))
    61  		})
    62  
    63  		time.Sleep(5 * time.Second)
    64  		session := helpers.CF("app", appName)
    65  		Eventually(session).Should(Say(`name:\s+%s`, appName))
    66  		Eventually(session).Should(Say(`last uploaded:\s+%s`, helpers.ReadableDateTimeRegex))
    67  		Eventually(session).Should(Say(`stack:\s+%s`, stackName))
    68  		Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
    69  		Eventually(session).Should(Say(`type:\s+web`))
    70  		Eventually(session).Should(Say(`instances:\s+2/2`))
    71  		Eventually(session).Should(Say(`memory usage:\s+70M`))
    72  		Eventually(session).Should(Say(`\s+state\s+since\s+cpu\s+memory\s+disk`))
    73  		Eventually(session).Should(Say(`#0\s+running\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`))
    74  		Eventually(session).Should(Exit(0))
    75  	})
    76  
    77  	It("creates the app with the specified settings, with the health check type being 'http'", func() {
    78  		helpers.WithHelloWorldApp(func(dir string) {
    79  			session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    80  				PushCommandName, appName,
    81  				"-b", "staticfile_buildpack",
    82  				"-c", fmt.Sprintf("echo 'hi' && %s", helpers.StaticfileBuildpackStartCommand),
    83  				"-u", "http",
    84  				"-k", "300M",
    85  				"-i", "2",
    86  				"-m", "70M",
    87  				"-s", stackName,
    88  				"-t", "180",
    89  			)
    90  
    91  			Eventually(session).Should(Say(`Getting app info\.\.\.`))
    92  			Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`))
    93  			Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName))
    94  			Eventually(session).Should(Say(`(?m)\s+buildpacks:\s+\+\s+staticfile_buildpack`))
    95  			Eventually(session).Should(Say(`\s+command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand)))
    96  			Eventually(session).Should(Say(`\s+disk quota:\s+300M`))
    97  			Eventually(session).Should(Say(`\s+health check http endpoint:\s+/`))
    98  			Eventually(session).Should(Say(`\s+health check timeout:\s+180`))
    99  			Eventually(session).Should(Say(`\s+health check type:\s+http`))
   100  			Eventually(session).Should(Say(`\s+instances:\s+2`))
   101  			Eventually(session).Should(Say(`\s+memory:\s+70M`))
   102  			Eventually(session).Should(Say(`\s+stack:\s+%s`, stackName))
   103  			Eventually(session).Should(Say(`\s+routes:`))
   104  			Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain()))
   105  			Eventually(session).Should(Say(`Mapping routes\.\.\.`))
   106  			Eventually(session).Should(Say(`Uploading files\.\.\.`))
   107  			Eventually(session).Should(Say("100.00%"))
   108  			Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
   109  			helpers.ConfirmStagingLogs(session)
   110  			Eventually(session).Should(Say(`Waiting for app to start\.\.\.`))
   111  			Eventually(session).Should(Say(`requested state:\s+started`))
   112  			Eventually(session).Should(Say(`start command:\s+echo 'hi' && %s`, regexp.QuoteMeta(helpers.StaticfileBuildpackStartCommand)))
   113  			Eventually(session).Should(Exit(0))
   114  		})
   115  
   116  		// output is different from when API version is below 3.27.0
   117  
   118  		time.Sleep(5 * time.Second)
   119  		session := helpers.CF("app", appName)
   120  		Eventually(session).Should(Say(`name:\s+%s`, appName))
   121  		Eventually(session).Should(Say(`last uploaded:\s+%s`, helpers.ReadableDateTimeRegex))
   122  		Eventually(session).Should(Say(`stack:\s+%s`, stackName))
   123  		Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
   124  		Eventually(session).Should(Say(`type:\s+web`))
   125  		Eventually(session).Should(Say(`instances:\s+2/2`))
   126  		Eventually(session).Should(Say(`memory usage:\s+70M`))
   127  		Eventually(session).Should(Say(`\s+state\s+since\s+cpu\s+memory\s+disk`))
   128  		Eventually(session).Should(Say(`#0\s+running\s+\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z`))
   129  		Eventually(session).Should(Exit(0))
   130  	})
   131  })