-
Notifications
You must be signed in to change notification settings - Fork 927
/
route_mapping.go
26 lines (22 loc) · 1015 Bytes
/
route_mapping.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
package helpers
import (
"fmt"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)
// MapRouteToApplication maps a route to an app using 'cf map-route' and asserts that
// the mapping exists.
func MapRouteToApplication(app string, domain string, host string, path string) {
Eventually(CF("map-route", app, domain, "--hostname", host, "--path", path)).Should(Exit(0))
Eventually(CF("routes")).Should(And(Exit(0), Say(
fmt.Sprintf("%s\\s+%s\\s+/?%s\\s+.*%s.*", host, domain, path, app))))
}
// UnmapRouteFromApplication unmaps a route from an app using 'cf unmap-route' and asserts that
// the mapping gets deleted.
func UnmapRouteFromApplication(app string, domain string, host string, path string) {
Eventually(CF("unmap-route", app, domain, "--hostname", host, "--path", path)).Should(Exit(0))
session := CF("routes")
Eventually(session).Should(Exit(0))
Eventually(session).ShouldNot(Say(fmt.Sprintf("%s\\s+%s\\s+/%s\\s+%s", host, domain, path, app)))
}