github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/v7/push/health_check_test.go (about)

     1  package push
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("push with health check type", func() {
    12  	var (
    13  		appName string
    14  	)
    15  
    16  	BeforeEach(func() {
    17  		appName = helpers.NewAppName()
    18  	})
    19  
    20  	Context("updating the application", func() {
    21  		BeforeEach(func() {
    22  			helpers.WithMultiEndpointApp(func(dir string) {
    23  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "http", "--endpoint", "/other_endpoint.html")
    24  				Eventually(session).Should(Exit(0))
    25  			})
    26  		})
    27  
    28  		When("setting the app to http health check type", func() {
    29  			It("should update the health check http endpoint", func() {
    30  				helpers.WithMultiEndpointApp(func(dir string) {
    31  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "http", "--endpoint", "/third_endpoint.html")).Should(Exit(0))
    32  				})
    33  
    34  				session := helpers.CF("get-health-check", appName)
    35  				Eventually(session).Should(Say("web\\s+http\\s+/third_endpoint.html"))
    36  				Eventually(session).Should(Exit(0))
    37  			})
    38  		})
    39  
    40  		When("setting the app to port health check type", func() {
    41  			It("should reset the health check http endpoint", func() {
    42  				helpers.WithMultiEndpointApp(func(dir string) {
    43  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "port")).Should(Exit(0))
    44  				})
    45  
    46  				session := helpers.CF("get-health-check", appName)
    47  				Eventually(session).Should(Say("web\\s+port\\s+1"))
    48  				Eventually(session).Should(Exit(0))
    49  			})
    50  		})
    51  
    52  		When("setting the app to process health check type", func() {
    53  			It("should reset the health check http endpoint", func() {
    54  				helpers.WithMultiEndpointApp(func(dir string) {
    55  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "process")).Should(Exit(0))
    56  				})
    57  
    58  				session := helpers.CF("get-health-check", appName)
    59  				Eventually(session).Should(Say("web\\s+process\\s+1"))
    60  				Eventually(session).Should(Exit(0))
    61  			})
    62  		})
    63  	})
    64  
    65  	Context("creating the application", func() {
    66  		When("setting a http health check type", func() {
    67  			It("should set the health check type to http and use the default health check endpoint", func() {
    68  				helpers.WithMultiEndpointApp(func(dir string) {
    69  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "http", "--endpoint", "/other_endpoint.html")).Should(Exit(0))
    70  				})
    71  
    72  				session := helpers.CF("get-health-check", appName)
    73  				Eventually(session).Should(Say("web\\s+http\\s+/other_endpoint.html"))
    74  				Eventually(session).Should(Exit(0))
    75  			})
    76  		})
    77  
    78  		When("setting a port health check type", func() {
    79  			It("it should set the health check type to port", func() {
    80  				helpers.WithMultiEndpointApp(func(dir string) {
    81  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "port")).Should(Exit(0))
    82  				})
    83  
    84  				session := helpers.CF("get-health-check", appName)
    85  				Eventually(session).Should(Say("web\\s+port"))
    86  				Eventually(session).Should(Exit(0))
    87  			})
    88  		})
    89  
    90  		When("setting a process health check type", func() {
    91  			It("it should set the health check type to process", func() {
    92  				helpers.WithMultiEndpointApp(func(dir string) {
    93  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "-u", "process")).Should(Exit(0))
    94  				})
    95  
    96  				session := helpers.CF("get-health-check", appName)
    97  				Eventually(session).Should(Say("web\\s+process"))
    98  				Eventually(session).Should(Exit(0))
    99  			})
   100  		})
   101  	})
   102  })