forked from cloudfoundry-community/cloudfoundry-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.go
62 lines (50 loc) · 1.29 KB
/
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
package helpers
import (
"time"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)
const (
CFRouteLongTimeout = 30 * time.Second
)
type Route struct {
Space string
Host string
Domain string
Path string
}
func NewRoute(space string, domain string, hostname string, path string) Route {
return Route{
Space: space,
Domain: domain,
Host: hostname,
Path: path,
}
}
func (r Route) Create() {
Eventually(CF("create-route", r.Space, r.Domain, "--hostname", r.Host, "--path", r.Path), CFRouteLongTimeout).Should(Exit(0))
}
func (r Route) Delete() {
Eventually(CF("delete-route", r.Domain, "--hostname", r.Host, "--path", r.Path, "-f"), CFRouteLongTimeout).Should(Exit(0))
}
type Domain struct {
Org string
Name string
}
func NewDomain(org string, name string) Domain {
return Domain{
Org: org,
Name: name,
}
}
func (d Domain) Create() {
Eventually(CF("create-domain", d.Org, d.Name), CFRouteLongTimeout).Should(Exit(0))
Eventually(CF("domains"), CFRouteLongTimeout).Should(And(Exit(0), Say(d.Name)))
}
func (d Domain) Share() {
Eventually(CF("share-private-domain", d.Org, d.Name), CFRouteLongTimeout).Should(Exit(0))
}
func (d Domain) Delete() {
Eventually(CF("delete-domain", d.Name, "-f"), CFRouteLongTimeout).Should(Exit(0))
}