-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add More Validation for api calls #229
Add More Validation for api calls #229
Conversation
GraphQL Schema CheckCompared 0 schema changes against 0 operations ✅ Found no changes |
@@ -121,6 +124,11 @@ func TestCreate_loadBalancer(t *testing.T) { | |||
Input: graphclient.CreateLoadBalancerInput{Name: name, ProviderID: prov.ID, OwnerID: ownerID, LocationID: ""}, | |||
errorMsg: "value is less than the required length", | |||
}, | |||
{ | |||
TestName: "fails to create loadbalancer with another loadbalancer's port", | |||
Input: graphclient.CreateLoadBalancerInput{Name: name, ProviderID: prov.ID, OwnerID: ownerID, LocationID: locationID, PortIDs: []gidx.PrefixedID{port.ID}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the better solution here would be that PortIDs
be removed from the input for LoadBalancers. I can't think of a valid example where we would ever want to create a load balancer and pass in existing port IDs for the ports on that LB. Especially since ports have to be mapped to a LB to get created in the first place.
TestName: "fails to update pool with port with conflicting OwnerID", | ||
Input: graphclient.UpdateLoadBalancerPoolInput{ | ||
Name: newString("ImaPool"), | ||
AddPortIDs: []gidx.PrefixedID{port.ID}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here, I don't think we want to allow users to pass PortIDs in ever on a load balancer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im assuming you are talking about UpdateLoadBalancerInput since we dont really mutate ports through the load balancer since ports dont exist without loadbalancers, and instead to mutate ports directly instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could the same be said with pools and origins since origins dont exist outside of pools (I think) and thus we shouldnt mutate origins through pools as well?
nvm I think origins and pools are m:m so would not make sense
The |
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
c10c4af
to
a6ca5da
Compare
Signed-off-by: Stephen Hwang <126002920+sthwang-metal@users.noreply.github.com>
closing in favour of this pr: #244 |
Adds more validation checks to the resolvers.