-
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
e2e tests for timeout and draining timeout #521
Conversation
Thanks! Will take a look soon. /ok-to-test |
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.
Thanks alot for these tests!
pkg/fuzz/helpers.go
Outdated
} | ||
|
||
// SetDrainTimeout defines the BackendConfig's draining timeout | ||
func (b *BackendConfigBuilder) SetDrainTimeout(timeout int64) *BackendConfigBuilder { |
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.
SetConnectionDrainingTimeout
cmd/e2e-test/draining_test.go
Outdated
} | ||
} | ||
|
||
func verifyDrainingTimeouts(t *testing.T, gclb *fuzz.GCLB, svcNamespace, svcName string, expectedTimeout int64) error { |
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.
verifyConnectionDrainingTimeout
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 overall, thanks!
cmd/e2e-test/draining_test.go
Outdated
t.Errorf("Delete(%q) = %v, want nil", ing.Name, err) | ||
} | ||
t.Logf("Waiting for GCLB resources to be deleted (%s/%s)", s.Namespace, ing.Name) | ||
if err := e2e.WaitForGCLBDeletion(ctx, Framework.Cloud, gclb, nil); err != nil { |
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.
Add SkipDefaultBackend option here as well.
cmd/e2e-test/timeout_test.go
Outdated
t.Errorf("Delete(%q) = %v, want nil", ing.Name, err) | ||
} | ||
t.Logf("Waiting for GCLB resources to be deleted (%s/%s)", s.Namespace, ing.Name) | ||
if err := e2e.WaitForGCLBDeletion(ctx, Framework.Cloud, gclb, nil); err != nil { |
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.
Can we add SkipDefaultBackend
option here similar to #523? We are hitting some test flakiness lately because the default backend service may not be cleaned up if there is any other ingress that needs it.
cmd/e2e-test/draining_test.go
Outdated
} | ||
|
||
if err := verifyConnectionDrainingTimeout(t, gclb, s.Namespace, "service-1", timeout); err != nil { | ||
t.Error(err) |
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.
Can we make an error message with verifyConnectionDrainingTimeout(...)=
format? Similar to
t.Errorf("verifySecurityPolicy(..., %q, %q, %q) = %v, want nil", s.Namespace, testSvc.Name, testSecurityPolicy.SelfLink, err) |
Otherwise it may be confusing in the logs as we run many tests in parallel.
beConfig: fuzz.NewBackendConfigBuilder("", "backendconfig-1"). | ||
Build(), | ||
}, | ||
} { |
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.
Ideally would be great to have a transition test as well (e.g. 60s -> 30s), but these should be good for the initial test.
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.
Will look into that next
cmd/e2e-test/timeout_test.go
Outdated
} | ||
|
||
if err := verifyTimeout(t, gclb, s.Namespace, "service-1", timeout); err != nil { | ||
t.Error(err) |
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.
log with format: verifyTimeout(...)=
/hold We can only merge this PR once we cut a new Ingress-GCE version. Thanks for the work! |
/hold cancel |
/lgtm |
@bpineau Can you fix the unit test? |
Those are simple tests checking that the settings from BackendConfig propagates well to the live BackendService. Let me know if you'd rather me to write fuzz http reqs testing real timeouts expirations (that's much more involved -esp. the connection draining part- so it'll take more time though).
Reflect changes to ConnectionDraining.DrainingTimeoutSec in e2e/fuzz tests.
Test draining timeouts changes/transitions.
Rebased / fixed the test, and added transitions tests (as was suggested by @MrHohn a few weeks ago). |
t.Errorf("verifyConnectionDrainingTimeout(..., %q, %q, %d) = %v, want nil", s.Namespace, "service-1", timeout, err) | ||
} | ||
|
||
// Test modifications/transitions |
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.
Ideally, the transition test should be another test func.
@bpineau Also can you please squash commits? |
@bpineau friendly ping |
/lgtm Let's just get this in, we can clean up the internals of the test later. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bpineau, rramkumar1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
As suggested by @MrHohn
Those are simple tests checking that the settings from BackendConfig propagates well
to the live BackendService.
Let me know if you'd rather me to write fuzz http reqs testing real timeouts expirations
(that's much more involved -esp. the connection draining part- so it'll take more time though).