Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
aedcad5
Running unit tests version
Dariquest Dec 19, 2024
c262724
Running unit tests version
Dariquest Dec 19, 2024
0105e89
Add MinVersionPerRouteOpts
Dariquest Dec 19, 2024
7ed07ef
Add MinVersionPerRouteOpts check for create and update route commands
Dariquest Dec 19, 2024
db8cf87
Remove double check
Dariquest Jan 9, 2025
e3e288d
Refactoring
Dariquest Jan 9, 2025
5c93571
New unit tests for route option removal
Dariquest Jan 9, 2025
95cb4be
New unit tests for route option removal
Dariquest Jan 9, 2025
bbe4c63
New unit tests for multiple option handling
Dariquest Jan 9, 2025
eb9f03d
Route command in the v7/commands
Dariquest Jan 17, 2025
a175b57
Fix ccv3 route test
Dariquest Jan 17, 2025
c06d0f0
Fix units
Dariquest Jan 17, 2025
a21a452
Changed typed route options to an untyped map
Dariquest Jan 20, 2025
177dab7
Merge branch 'v8' into updateRouteCommands
Dariquest Jan 20, 2025
38b8fe8
Removing all the changes in cf/commands
Dariquest Jan 20, 2025
60eec2e
Removing all the changes in cf/commands
Dariquest Jan 20, 2025
68b21eb
Removing a duplicate line
Dariquest Jan 21, 2025
08df90c
Fix linter issues
hoffmaen Jan 23, 2025
0874b29
Restore unnecessary fakes
Dariquest Jan 23, 2025
795034d
Restore non relevant fakes
Dariquest Jan 23, 2025
980e156
Restore non relevant fakes
Dariquest Jan 23, 2025
dbc34d7
Restore non relevant fakes
Dariquest Jan 23, 2025
d3a38bc
Refactoring
Dariquest Jan 23, 2025
7991003
Merge branch 'v8' into updateRouteCommands
Dariquest Jan 24, 2025
2f55a61
Review changes
Dariquest Jan 27, 2025
8e0e6da
Review changes units
Dariquest Jan 27, 2025
2df7ad5
Change DisplayText to DisplayWarning for flag spec err
Dariquest Jan 28, 2025
7086b94
Output an error if at least one option is specified incorrectly
Dariquest Jan 28, 2025
b6382bb
Output an error if at least one option is specified incorrectly
Dariquest Jan 28, 2025
1ea7ade
Merge branch 'v8' into updateRouteCommands
Dariquest Jan 29, 2025
6b50b9e
Fix helper
Dariquest Jan 29, 2025
b07e028
New integration test and adjustments of other tests
Dariquest Jan 30, 2025
17b0c06
Fix integration tests
Dariquest Jan 30, 2025
746e363
Fix integration tests
Dariquest Jan 30, 2025
35c5f3c
Fix integration tests
Dariquest Jan 31, 2025
d3cd7ef
Merge branch 'v8' into updateRouteCommands
Dariquest Jan 31, 2025
498f173
Consistent naming: per-route options vs route specific options
Dariquest Jan 31, 2025
60c9144
Las integration test corrections
Dariquest Jan 31, 2025
06bf4d1
Change command description
Dariquest Jan 31, 2025
d6c90e6
Merge branch 'v8' into updateRouteCommands
Dariquest Feb 3, 2025
27bdf7f
Rename least-connections to least-connection
Dariquest Feb 3, 2025
b77d326
Rename least-connections to least-connection
Dariquest Feb 3, 2025
849f5a4
Merge branch 'v8' into updateRouteCommands
Dariquest Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions actor/actionerror/route_option_error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package actionerror

import "fmt"

// RouteOptionError is returned when a route option was specified in the wrong format
type RouteOptionError struct {
Name string
Host string
DomainName string
Path string
}

func (e RouteOptionError) Error() string {
return fmt.Sprintf("Route option '%s' for route with host '%s', domain '%s', and path '%s' was specified incorrectly. Please use key-value pair format key=value.", e.Name, e.Host, e.DomainName, e.path())
}

func (e RouteOptionError) path() string {
if e.Path == "" {
return "/"
}
return e.Path
}
12 changes: 12 additions & 0 deletions actor/actionerror/route_option_support_error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package actionerror

import "fmt"

// RouteOptionSupportError is returned when route options are not supported
type RouteOptionSupportError struct {
ErrorText string
}

func (e RouteOptionSupportError) Error() string {
return fmt.Sprintf("Route option support: '%s'", e.ErrorText)
}
1 change: 1 addition & 0 deletions actor/v7action/cloud_controller_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ type CloudControllerClient interface {
UpdateOrganizationQuota(orgQuota resources.OrganizationQuota) (resources.OrganizationQuota, ccv3.Warnings, error)
UpdateProcess(process resources.Process) (resources.Process, ccv3.Warnings, error)
UpdateResourceMetadata(resource string, resourceGUID string, metadata resources.Metadata) (ccv3.JobURL, ccv3.Warnings, error)
UpdateRoute(routeGUID string, options map[string]*string) (resources.Route, ccv3.Warnings, error)
UpdateSecurityGroupRunningSpace(securityGroupGUID string, spaceGUIDs []string) (ccv3.Warnings, error)
UpdateSecurityGroupStagingSpace(securityGroupGUID string, spaceGUIDs []string) (ccv3.Warnings, error)
UpdateSecurityGroup(securityGroup resources.SecurityGroup) (resources.SecurityGroup, ccv3.Warnings, error)
Expand Down
8 changes: 7 additions & 1 deletion actor/v7action/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type RouteSummary struct {
ServiceInstanceName string
}

func (actor Actor) CreateRoute(spaceGUID, domainName, hostname, path string, port int) (resources.Route, Warnings, error) {
func (actor Actor) CreateRoute(spaceGUID, domainName, hostname, path string, port int, options map[string]*string) (resources.Route, Warnings, error) {
allWarnings := Warnings{}
domain, warnings, err := actor.GetDomainByName(domainName)
allWarnings = append(allWarnings, warnings...)
Expand All @@ -41,6 +41,7 @@ func (actor Actor) CreateRoute(spaceGUID, domainName, hostname, path string, por
Host: hostname,
Path: path,
Port: port,
Options: options,
})

actorWarnings := Warnings(apiWarnings)
Expand Down Expand Up @@ -401,6 +402,11 @@ func (actor Actor) MapRoute(routeGUID string, appGUID string, destinationProtoco
return Warnings(warnings), err
}

func (actor Actor) UpdateRoute(routeGUID string, options map[string]*string) (resources.Route, Warnings, error) {
route, warnings, err := actor.CloudControllerClient.UpdateRoute(routeGUID, options)
return route, Warnings(warnings), err
}

func (actor Actor) UpdateDestination(routeGUID string, destinationGUID string, protocol string) (Warnings, error) {
warnings, err := actor.CloudControllerClient.UpdateDestination(routeGUID, destinationGUID, protocol)
return Warnings(warnings), err
Expand Down
10 changes: 8 additions & 2 deletions actor/v7action/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ var _ = Describe("Route Actions", func() {
hostname string
path string
port int
options map[string]*string
)

BeforeEach(func() {
hostname = ""
path = ""
port = 0
lbLCVal := "least-connection"
lbLeastConnections := &lbLCVal
options = map[string]*string{"loadbalancing": lbLeastConnections}
})

JustBeforeEach(func() {
_, warnings, executeErr = actor.CreateRoute("space-guid", "domain-name", hostname, path, port)
_, warnings, executeErr = actor.CreateRoute("space-guid", "domain-name", hostname, path, port, options)
})

When("the API layer calls are successful", func() {
Expand All @@ -56,7 +60,7 @@ var _ = Describe("Route Actions", func() {
)

fakeCloudControllerClient.CreateRouteReturns(
resources.Route{GUID: "route-guid", SpaceGUID: "space-guid", DomainGUID: "domain-guid", Host: "hostname", Path: "path-name"},
resources.Route{GUID: "route-guid", SpaceGUID: "space-guid", DomainGUID: "domain-guid", Host: "hostname", Path: "path-name", Options: options},
ccv3.Warnings{"create-warning-1", "create-warning-2"},
nil)
})
Expand All @@ -80,6 +84,7 @@ var _ = Describe("Route Actions", func() {
DomainGUID: "domain-guid",
Host: hostname,
Path: path,
Options: options,
},
))
})
Expand All @@ -102,6 +107,7 @@ var _ = Describe("Route Actions", func() {
SpaceGUID: "space-guid",
DomainGUID: "domain-guid",
Port: 1234,
Options: options,
},
))
})
Expand Down
86 changes: 86 additions & 0 deletions actor/v7action/v7actionfakes/fake_cloud_controller_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion actor/v7pushaction/v7_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type V7Actor interface {
CreateBitsPackageByApplication(appGUID string) (resources.Package, v7action.Warnings, error)
CreateDeployment(dep resources.Deployment) (string, v7action.Warnings, error)
CreateDockerPackageByApplication(appGUID string, dockerImageCredentials v7action.DockerImageCredentials) (resources.Package, v7action.Warnings, error)
CreateRoute(spaceGUID, domainName, hostname, path string, port int) (resources.Route, v7action.Warnings, error)
CreateRoute(spaceGUID, domainName, hostname, path string, port int, options map[string]*string) (resources.Route, v7action.Warnings, error)
GetApplicationByNameAndSpace(appName string, spaceGUID string) (resources.Application, v7action.Warnings, error)
GetApplicationDroplets(appName string, spaceGUID string) ([]resources.Droplet, v7action.Warnings, error)
GetApplicationRoutes(appGUID string) ([]resources.Route, v7action.Warnings, error)
Expand All @@ -41,6 +41,7 @@ type V7Actor interface {
UnmapRoute(routeGUID string, destinationGUID string) (v7action.Warnings, error)
UpdateApplication(app resources.Application) (resources.Application, v7action.Warnings, error)
UpdateProcessByTypeAndApplication(processType string, appGUID string, updatedProcess resources.Process) (v7action.Warnings, error)
UpdateRoute(routeGUID string, options map[string]*string) (resources.Route, v7action.Warnings, error)
UploadBitsPackage(pkg resources.Package, matchedResources []sharedaction.V3Resource, newResources io.Reader, newResourcesLength int64) (resources.Package, v7action.Warnings, error)
UploadDroplet(dropletGUID string, dropletPath string, progressReader io.Reader, fileSize int64) (v7action.Warnings, error)
}
Loading
Loading