github.com/loafoe/cli@v7.1.0+incompatible/integration/shared/plugin/logs_test.go (about)

     1  package plugin
     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("logs", func() {
    12  	BeforeEach(func() {
    13  		installTestPlugin()
    14  	})
    15  
    16  	AfterEach(func() {
    17  		uninstallTestPlugin()
    18  	})
    19  
    20  	var (
    21  		organization string
    22  		space        string
    23  		appName      string
    24  	)
    25  
    26  	BeforeEach(func() {
    27  		organization, space = createTargetedOrgAndSpace()
    28  		appName = helpers.PrefixedRandomName("APP")
    29  	})
    30  
    31  	AfterEach(func() {
    32  		helpers.QuickDeleteSpace(space)
    33  		helpers.QuickDeleteOrg(organization)
    34  	})
    35  
    36  	When("pushing an application from a plugin", func() {
    37  		It("outputs logs from the staging process", func() {
    38  			helpers.WithHelloWorldApp(func(appDir string) {
    39  				session := helpers.CF("CliCommand", "push",
    40  					appName, "-p", appDir, "-b", "staticfile_buildpack")
    41  				Eventually(session).Should(Exit(0))
    42  				Expect(session).To(Say("Downloading app package..."))
    43  				Expect(session).To(Say("Creating app"))
    44  			})
    45  		})
    46  	})
    47  
    48  	When("tailing logs for an app from a plugin", func() {
    49  		BeforeEach(func() {
    50  			helpers.WithHelloWorldApp(func(appDir string) {
    51  				session := helpers.CF("push", appName, "-p", appDir, "-b", "staticfile_buildpack")
    52  				Eventually(session).Should(Exit(0))
    53  			})
    54  		})
    55  
    56  		It("outputs the application logs", func() {
    57  			logSession := helpers.CF("CliCommand", "logs", appName)
    58  
    59  			restageSession := helpers.CF("restage", appName)
    60  			Eventually(restageSession).Should(Exit(0))
    61  
    62  			Eventually(logSession).Should(Say("Staticfile Buildpack version"))
    63  			logSession.Kill()
    64  
    65  			Eventually(logSession).Should(Exit())
    66  		})
    67  
    68  	})
    69  
    70  	When("viewing recent logs for an app from a plugin", func() {
    71  
    72  		BeforeEach(func() {
    73  			helpers.WithHelloWorldApp(func(appDir string) {
    74  				session := helpers.CF("push", appName, "-p", appDir, "-b", "staticfile_buildpack")
    75  				Eventually(session).Should(Exit(0))
    76  			})
    77  		})
    78  
    79  		It("outputs the recent application logs", func() {
    80  			session := helpers.CF("CliCommand", "logs", appName, "--recent")
    81  			Eventually(session).Should(Exit(0))
    82  			Expect(session).To(Say("Staticfile Buildpack version"))
    83  		})
    84  
    85  	})
    86  })