-
Notifications
You must be signed in to change notification settings - Fork 303
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 negative test cases for backend config #383
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,10 +32,9 @@ import ( | |
) | ||
|
||
var ( | ||
ErrBackendConfigsFromAnnotation = errors.New("error getting BackendConfig's from annotation") | ||
ErrBackendConfigDoesNotExist = errors.New("no BackendConfig for service port exists.") | ||
ErrBackendConfigFailedToGet = errors.New("client had error getting BackendConfig for service port.") | ||
ErrNoBackendConfigForPort = errors.New("no BackendConfig name found for service port.") | ||
ErrBackendConfigDoesNotExist = errors.New("no BackendConfig for service port exists.") | ||
ErrBackendConfigFailedToGet = errors.New("client had error getting BackendConfig for service port.") | ||
ErrNoBackendConfigForPort = errors.New("no BackendConfig name found for service port.") | ||
) | ||
|
||
func CRDMeta() *crd.CRDMeta { | ||
|
@@ -95,7 +94,7 @@ func GetBackendConfigForServicePort(backendConfigLister cache.Store, svc *apiv1. | |
if err == annotations.ErrBackendConfigAnnotationMissing { | ||
return nil, nil | ||
} | ||
return nil, ErrBackendConfigsFromAnnotation | ||
return nil, err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the reason for the change here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was meant to make the warning event more useful. Without this change, when annotation is in invalid format, user will see something like "error getting backend config" instead of "the annotation is invalid". |
||
} | ||
|
||
configName := BackendConfigName(*backendConfigs, *svcPort) | ||
|
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.
Given how the code is written, you will actually have to create the secret "bar". Otherwise, it will return an error saying the secret does not exist, rather than the error we actually are testing for,
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.
Good catch, I'm seeing this:
Added the logic to actually create the secret "bar".