github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/integration/v7/push/manifest_diff_test.go (about)

     1  package push
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"code.cloudfoundry.org/cli/integration/helpers"
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  	. "github.com/onsi/gomega/gbytes"
    10  	. "github.com/onsi/gomega/gexec"
    11  )
    12  
    13  var _ = Describe("displaying manifest differences between pushes", func() {
    14  	var (
    15  		appName string
    16  	)
    17  
    18  	BeforeEach(func() {
    19  		appName = helpers.PrefixedRandomName("app")
    20  	})
    21  	When("there is an app that has been pushed and we push it again with a different manifest", func() {
    22  		It("displays the diff from the manifest", func() {
    23  			helpers.WithHelloWorldApp(func(dir string) {
    24  
    25  				pathToManifest := filepath.Join(dir, "manifest.yml")
    26  				helpers.WriteManifest(pathToManifest, map[string]interface{}{
    27  					"applications": []map[string]interface{}{
    28  						{
    29  							"name":      appName,
    30  							"instances": 1,
    31  						},
    32  					},
    33  				})
    34  
    35  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName)
    36  				Eventually(session).Should(Exit(0))
    37  				Expect(session).To(Say("name:\\s+%s", appName))
    38  
    39  				helpers.WriteManifest(pathToManifest, map[string]interface{}{
    40  					"applications": []map[string]interface{}{
    41  						{
    42  							"name":      appName,
    43  							"instances": 2,
    44  						},
    45  					},
    46  				})
    47  
    48  				session = helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName)
    49  				Eventually(session).Should(Exit(0))
    50  				Expect(session).To(Say("name:\\s+%s", appName))
    51  				Expect(session).To(Say(`\-   instances: 1`))
    52  				Expect(session).To(Say(`\+   instances: 2`))
    53  			})
    54  		})
    55  	})
    56  })