@@ -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,45 @@ var _ = Describe("update-route command", func() {
113115 })
114116 })
115117
118+ When ("a hash-based routing is enabled and options are specified" , func () {
119+ BeforeEach (func () {
120+ helpers .EnableFeatureFlag ("hash_based_routing" )
121+ })
122+ AfterEach (func () {
123+ helpers .DisableFeatureFlag ("hash_based_routing" )
124+ })
125+
126+ It ("updates the route and runs to completion without failing" , func () {
127+ optionLBAlgo := "loadbalancing=hash"
128+ optionHashHeader := "hash_header=X-Header"
129+ optionHashBalance := "hash_balance=1.3"
130+ session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , optionLBAlgo , "--option" , optionHashHeader , "--option" , optionHashBalance )
131+ Eventually (session ).Should (Say (`Updating route %s\.%s%s for org %s / space %s as %s\.\.\.` , hostname , domainName , path , orgName , spaceName , userName ))
132+ Eventually (session ).Should (Say (`Route %s\.%s%s has been updated` , hostname , domainName , path ))
133+ Eventually (session ).Should (Say (`OK` ))
134+ Eventually (session ).Should (Exit (0 ))
135+ })
136+ Context ("missing required options for hash-based routing" , func () {
137+ It ("update fails" , func () {
138+ optionLBAlgo := "loadbalancing=hash"
139+ session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , optionLBAlgo )
140+ Eventually (session .Err ).Should (Say (`Hash header must be present when loadbalancing is set to hash` ))
141+ Eventually (session ).Should (Exit (1 ))
142+ })
143+ })
144+ Context ("with wrong loadbalancing option" , func () {
145+ It ("update fails" , func () {
146+ optionLBAlgo := "loadbalancing=round-robin"
147+ optionHashHeader := "hash_header=X-Header"
148+ optionHashBalance := "hash_balance=1.3"
149+ session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path , "--option" , optionLBAlgo , "--option" , optionHashHeader , "--option" , optionHashBalance )
150+ Eventually (session .Err ).Should (Say (`Options Hash header can only be set when loadbalancing is hash` ))
151+ Eventually (session .Err ).Should (Say (`Options Hash balance can only be set when loadbalancing is hash` ))
152+ Eventually (session ).Should (Exit (1 ))
153+ })
154+ })
155+ })
156+
116157 When ("route options are not specified" , func () {
117158 It ("gives an error message and fails" , func () {
118159 session := helpers .CF ("update-route" , domainName , "--hostname" , hostname , "--path" , path )
0 commit comments