@@ -31,6 +31,8 @@ var _ = Describe("update-route command", func() {
3131 Eventually (session ).Should (Say (`EXAMPLES:` ))
3232 Eventually (session ).Should (Say (`cf update-route example.com -o loadbalancing=round-robin` ))
3333 Eventually (session ).Should (Say (`cf update-route example.com -o loadbalancing=least-connection` ))
34+ Eventually (session ).Should (Say (`cf update-route example.com -o loadbalancing=hash -o hash_header=My-Hash-Header` ))
35+ Eventually (session ).Should (Say (`cf update-route example.com -o loadbalancing=hash -o hash_header=My-Hash-Header -o hash_balance=1.3` ))
3436 Eventually (session ).Should (Say (`cf update-route example.com -r loadbalancing` ))
3537 Eventually (session ).Should (Say (`cf update-route example.com --hostname myhost --path foo -o loadbalancing=round-robin` ))
3638 Eventually (session ).Should (Say (`\n` ))
@@ -102,7 +104,7 @@ var _ = Describe("update-route command", func() {
102104 AfterEach (func () {
103105 domain .Delete ()
104106 })
105- When ("a route option is specified" , func () {
107+ When ("a loadbalancing route option is specified" , func () {
106108 It ("updates the route and runs to completion without failing" , func () {
107109 option = "loadbalancing=round-robin"
108110 session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , option )
@@ -113,6 +115,38 @@ var _ = Describe("update-route command", func() {
113115 })
114116 })
115117
118+ When ("a hash-based routing options are specified" , func () {
119+ It ("updates the route and runs to completion without failing" , func () {
120+ optionLBAlgo := "loadbalancing=hash"
121+ optionHashHeader := "hash_header=X-Header"
122+ optionHashBalance := "hash_balance=1.3"
123+ session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , optionLBAlgo , "--option" , optionHashHeader , "--option" , optionHashBalance )
124+ Eventually (session ).Should (Say (`Updating route %s\.%s%s for org %s / space %s as %s\.\.\.` , hostname , domainName , path , orgName , spaceName , userName ))
125+ Eventually (session ).Should (Say (`Route %s\.%s%s has been updated` , hostname , domainName , path ))
126+ Eventually (session ).Should (Say (`OK` ))
127+ Eventually (session ).Should (Exit (0 ))
128+ })
129+ Context ("missing required options for hash-based routing" , func () {
130+ It ("update fails" , func () {
131+ optionLBAlgo := "loadbalancing=hash"
132+ session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , optionLBAlgo )
133+ Eventually (session .Err ).Should (Say (`Hash header must be present when loadbalancing is set to hash` ))
134+ Eventually (session ).Should (Exit (1 ))
135+ })
136+ })
137+ Context ("with wrong loadbalancing option" , func () {
138+ It ("update fails" , func () {
139+ optionLBAlgo := "loadbalancing=round-robin"
140+ optionHashHeader := "hash_header=X-Header"
141+ optionHashBalance := "hash_balance=1.3"
142+ session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , optionLBAlgo , "--option" , optionHashHeader , "--option" , optionHashBalance )
143+ Eventually (session .Err ).Should (Say (`Options Hash header can only be set when loadbalancing is hash` ))
144+ Eventually (session .Err ).Should (Say (`Options Hash balance can only be set when loadbalancing is hash` ))
145+ Eventually (session ).Should (Exit (1 ))
146+ })
147+ })
148+ })
149+
116150 When ("route options are not specified" , func () {
117151 It ("gives an error message and fails" , func () {
118152 session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path )
0 commit comments