-
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
IAP + CDN e2e testing implementation #319
Conversation
4fbdc3a
to
ba89130
Compare
/assign @bowei |
c113c28
to
85d1b07
Compare
pkg/fuzz/features/cdn.go
Outdated
) | ||
|
||
// Cdn is a feature in BackendConfig that supports using GCP CDN. | ||
var Cdn = &CDNFeature{} |
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.
cdn? (no need to export?)
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.
Since I made this fully capitalized now, it will technically be exported.
|
||
// ModifyRequest implements fuzz.FeatureValidator. | ||
func (v *cdnValidator) ModifyRequest(host, path string, req *http.Request) { | ||
// Warm up the cache, regardless of whether this host + path has CDN enabled. |
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.
should probably comment that // cache=true makes the echo server add caching headers
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.
Done..
pkg/fuzz/features/features.go
Outdated
@@ -25,4 +25,6 @@ import "k8s.io/ingress-gce/pkg/fuzz" | |||
var All = []fuzz.Feature{ | |||
AllowHTTP, | |||
PresharedCert, | |||
Cdn, |
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.
CDN
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.
Done.
pkg/fuzz/features/features.go
Outdated
@@ -25,4 +25,6 @@ import "k8s.io/ingress-gce/pkg/fuzz" | |||
var All = []fuzz.Feature{ | |||
AllowHTTP, | |||
PresharedCert, | |||
Cdn, | |||
Iap, |
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.
IAP (golang code style)
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.
Done.
var iapEnabled bool | ||
if backendConfig.Spec.Iap != nil && backendConfig.Spec.Iap.Enabled == true { | ||
iapEnabled = true | ||
} |
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.
do you need iapEnabled? why not return if false?
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.
See comment below.
return fuzz.CheckResponseSkip, nil | ||
} | ||
// If IAP is turned off, verify that the response code was not 302. | ||
if !iapEnabled && resp.StatusCode == http.StatusFound { |
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.
don't need this?, standard check will be for 200
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.
The main reason was to return a custom error.
85d1b07
to
099cc22
Compare
We need to tag the image used for guitar tests. Right now as it targets master, the tests will start failing as it is testing the old ingress controller. Let's talk tomorrow. /lgtm |
New changes are detected. LGTM label has been removed. |
964bc09
to
a53c89f
Compare
a53c89f
to
685c357
Compare
) | ||
|
||
// BackendConfigForPath returns the BackendConfig associated with the given path. | ||
// Note: This function returns an empty object (not nil pointer) if a BackendConfig |
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.
we probably want to distinguish these two cases for testing BackendConfig does not exist vs BackendConfig exists but is empty.
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.
You mean have separate function for each case? I can take care of it in a separate PR.
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.
lgtm except for the helper function
Note that this PR also contains some small changes to the validator:
1. In order to prevent the http client in the validator from following redirects, I implemented the
CheckRedirect hook.
2. Move the pathToDefaultBackend variable up higher so that other files can use it.
Ref: #301
This change is