github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/v6/push/trigger_legacy_push_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("triggering legacy push", func() {
    14  	var (
    15  		appName       string
    16  		host          string
    17  		defaultDomain string
    18  		privateDomain string
    19  	)
    20  
    21  	BeforeEach(func() {
    22  		appName = helpers.NewAppName()
    23  		host = helpers.NewAppName()
    24  		defaultDomain = helpers.DefaultSharedDomain()
    25  
    26  		privateDomain = helpers.NewDomainName()
    27  		domain := helpers.NewDomain(organization, privateDomain)
    28  		domain.Create()
    29  	})
    30  
    31  	When("there are global properties in the manifest", func() {
    32  		It("triggering old push with deprecation warning", func() {
    33  			helpers.WithHelloWorldApp(func(dir string) {
    34  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
    35  					"host": host,
    36  					"applications": []map[string]string{
    37  						{
    38  							"name": appName,
    39  						},
    40  					},
    41  				})
    42  
    43  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
    44  				Eventually(session.Err).Should(Say("Deprecation warning: Specifying app manifest attributes at the top level is deprecated."))
    45  				Eventually(session.Err).Should(Say(`Found: host\.`))
    46  				Eventually(session).Should(Say(`Creating route %s\.%s`, host, defaultDomain))
    47  			})
    48  		})
    49  	})
    50  
    51  	When("there is an 'inherit' property in the manifest", func() {
    52  		It("triggering old push with deprecation warning", func() {
    53  			helpers.WithHelloWorldApp(func(dir string) {
    54  				helpers.WriteManifest(filepath.Join(dir, "parent.yml"), map[string]interface{}{
    55  					"host": host,
    56  				})
    57  
    58  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
    59  					"inherit": "./parent.yml",
    60  					"applications": []map[string]string{
    61  						{
    62  							"name": appName,
    63  						},
    64  					},
    65  				})
    66  
    67  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
    68  				Eventually(session.Err).Should(Say("Deprecation warning: App manifest inheritance is deprecated."))
    69  				Eventually(session).Should(Say(`Creating route %s\.%s`, host, defaultDomain))
    70  				Eventually(session).Should(Say("OK"))
    71  				Eventually(session).Should(Exit(0))
    72  			})
    73  		})
    74  	})
    75  
    76  	When("there is a 'domain' property in the manifest", func() {
    77  		It("triggering old push with deprecation warning", func() {
    78  			helpers.WithHelloWorldApp(func(dir string) {
    79  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
    80  					"applications": []map[string]string{
    81  						{
    82  							"name":   appName,
    83  							"domain": defaultDomain,
    84  						},
    85  					},
    86  				})
    87  
    88  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
    89  				Eventually(session.Err).Should(Say("Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: domain."))
    90  				Eventually(session).Should(Say(`(?i)Creating route %s\.%s`, appName, defaultDomain))
    91  				Eventually(session).Should(Say("OK"))
    92  				Eventually(session).Should(Exit(0))
    93  			})
    94  		})
    95  	})
    96  
    97  	When("there is a 'domains' property in the manifest", func() {
    98  		It("triggering old push with deprecation warning", func() {
    99  			helpers.WithHelloWorldApp(func(dir string) {
   100  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
   101  					"applications": []map[string]interface{}{
   102  						{
   103  							"name":    appName,
   104  							"domains": []string{defaultDomain},
   105  						},
   106  					},
   107  				})
   108  
   109  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
   110  				Eventually(session.Err).Should(Say("Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: domains."))
   111  				Eventually(session).Should(Say(`(?i)Creating route %s\.%s`, appName, defaultDomain))
   112  				Eventually(session).Should(Say("OK"))
   113  				Eventually(session).Should(Exit(0))
   114  			})
   115  		})
   116  	})
   117  
   118  	When("there is a 'host' property in the manifest", func() {
   119  		It("triggering old push with deprecation warning", func() {
   120  			helpers.WithHelloWorldApp(func(dir string) {
   121  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
   122  					"applications": []map[string]string{
   123  						{
   124  							"name": appName,
   125  							"host": host,
   126  						},
   127  					},
   128  				})
   129  
   130  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
   131  				Eventually(session.Err).Should(Say("Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: host."))
   132  				Eventually(session).Should(Say(`(?i)Creating route %s\.%s`, host, defaultDomain))
   133  				Eventually(session).Should(Say("OK"))
   134  				Eventually(session).Should(Exit(0))
   135  			})
   136  		})
   137  	})
   138  
   139  	When("there is a 'hosts' property in the manifest", func() {
   140  		It("triggering old push with deprecation warning", func() {
   141  			helpers.WithHelloWorldApp(func(dir string) {
   142  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
   143  					"applications": []map[string]interface{}{
   144  						{
   145  							"name":  appName,
   146  							"hosts": []string{host},
   147  						},
   148  					},
   149  				})
   150  
   151  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
   152  				Eventually(session.Err).Should(Say("Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: hosts."))
   153  				Eventually(session).Should(Say(`(?i)Creating route %s\.%s`, host, defaultDomain))
   154  				Eventually(session).Should(Say("OK"))
   155  				Eventually(session).Should(Exit(0))
   156  			})
   157  		})
   158  	})
   159  
   160  	When("there is a 'no-hostname' property in the manifest", func() {
   161  
   162  		It("triggering old push with deprecation warning", func() {
   163  			helpers.WithHelloWorldApp(func(dir string) {
   164  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
   165  					"applications": []map[string]interface{}{
   166  						{
   167  							"name":        appName,
   168  							"no-hostname": true,
   169  						},
   170  					},
   171  				})
   172  
   173  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start", "-d", privateDomain)
   174  				Eventually(session.Err).Should(Say("Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: no-hostname."))
   175  				Eventually(session).Should(Say("(?i)Creating route %s", privateDomain))
   176  				Eventually(session).Should(Say("OK"))
   177  				Eventually(session).Should(Exit(0))
   178  			})
   179  		})
   180  	})
   181  
   182  	When("there is an 'inherit' property and a 'hostname' property in the manifest", func() {
   183  		It("triggering old push with deprecation warning", func() {
   184  			helpers.WithHelloWorldApp(func(dir string) {
   185  				helpers.WriteManifest(filepath.Join(dir, "parent.yml"), map[string]interface{}{
   186  					"domain": privateDomain,
   187  				})
   188  
   189  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
   190  					"inherit": "./parent.yml",
   191  					"applications": []map[string]string{
   192  						{
   193  							"name": appName,
   194  							"host": host,
   195  						},
   196  					},
   197  				})
   198  
   199  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
   200  				Eventually(session.Err).Should(Say("Deprecation warning: App manifest inheritance is deprecated."))
   201  				Eventually(session).Should(Say(`Creating route %s\.%s`, host, privateDomain))
   202  				Eventually(session).Should(Say("OK"))
   203  				Eventually(session).Should(Exit(0))
   204  			})
   205  		})
   206  	})
   207  
   208  	When("there is a 'domain' property and a 'host' property in the manifest", func() {
   209  		It("triggering old push with deprecation warning", func() {
   210  			helpers.WithHelloWorldApp(func(dir string) {
   211  				helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{
   212  					"applications": []map[string]string{
   213  						{
   214  							"name":   appName,
   215  							"domain": privateDomain,
   216  							"host":   host,
   217  						},
   218  					},
   219  				})
   220  
   221  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "--no-start")
   222  				Eventually(session.Err).Should(Say("Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: domain, host."))
   223  				Eventually(session).Should(Say(`(?i)Creating route %s\.%s`, host, privateDomain))
   224  				Eventually(session).Should(Say("OK"))
   225  				Eventually(session).Should(Exit(0))
   226  			})
   227  		})
   228  	})
   229  })