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