forked from cloudfoundry/cf-acceptance-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_route.go
67 lines (54 loc) · 2.37 KB
/
delete_route.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package apps
import (
. "github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
)
var _ = AppsDescribe("Delete Route", func() {
var (
appName string
expectedNullResponse string
)
BeforeEach(func() {
appName = random_name.CATSRandomName("APP")
appUrl := "https://" + appName + "." + Config.GetAppsDomain()
nullSession := helpers.CurlSkipSSL(Config.GetSkipSSLValidation(), appUrl).Wait()
expectedNullResponse = string(nullSession.Buffer().Contents())
Expect(cf.Cf("push",
appName,
"-b", Config.GetBinaryBuildpackName(),
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Catnip,
"-c", "./catnip",
"-d", Config.GetAppsDomain()).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Catnip?"))
})
AfterEach(func() {
app_helpers.AppReport(appName)
Expect(cf.Cf("delete", appName, "-f", "-r").Wait()).To(Exit(0))
})
Describe("Removing the route", func() {
It("Should be able to remove and delete the route", func() {
secondHost := random_name.CATSRandomName("ROUTE")
By("adding a route")
Eventually(cf.Cf("map-route", appName, Config.GetAppsDomain(), "-n", secondHost)).Should(Exit(0))
Eventually(helpers.CurlingAppRoot(Config, appName)).Should(ContainSubstring("Catnip?"))
Eventually(helpers.CurlingAppRoot(Config, secondHost)).Should(ContainSubstring("Catnip?"))
By("removing a route")
Eventually(cf.Cf("unmap-route", appName, Config.GetAppsDomain(), "-n", secondHost)).Should(Exit(0))
Eventually(helpers.CurlingAppRoot(Config, secondHost)).ShouldNot(ContainSubstring("Catnip?"))
Eventually(helpers.CurlingAppRoot(Config, appName)).Should(ContainSubstring("Catnip?"))
By("deleting the original route")
Expect(cf.Cf("delete-route", Config.GetAppsDomain(), "-n", appName, "-f").Wait()).To(Exit(0))
Eventually(helpers.CurlingAppRoot(Config, appName)).Should(ContainSubstring(expectedNullResponse))
})
})
})