Skip to content
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

Merged
merged 5 commits into from
Nov 19, 2018
Merged

e2e tests for timeout and draining timeout #521

merged 5 commits into from
Nov 19, 2018

Conversation

bpineau
Copy link
Contributor

@bpineau bpineau commented Oct 22, 2018

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).

@MrHohn
Copy link
Member

MrHohn commented Oct 22, 2018

Thanks! Will take a look soon.
/assign @MrHohn @rramkumar1

/ok-to-test

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 22, 2018
@MrHohn MrHohn removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 22, 2018
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 22, 2018
Copy link
Contributor

@rramkumar1 rramkumar1 left a 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!

}

// SetDrainTimeout defines the BackendConfig's draining timeout
func (b *BackendConfigBuilder) SetDrainTimeout(timeout int64) *BackendConfigBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetConnectionDrainingTimeout

}
}

func verifyDrainingTimeouts(t *testing.T, gclb *fuzz.GCLB, svcNamespace, svcName string, expectedTimeout int64) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verifyConnectionDrainingTimeout

Copy link
Member

@MrHohn MrHohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, thanks!

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 {
Copy link
Member

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.

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 {
Copy link
Member

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.

}

if err := verifyConnectionDrainingTimeout(t, gclb, s.Namespace, "service-1", timeout); err != nil {
t.Error(err)
Copy link
Member

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(),
},
} {
Copy link
Member

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.

Copy link
Contributor Author

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

}

if err := verifyTimeout(t, gclb, s.Namespace, "service-1", timeout); err != nil {
t.Error(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log with format: verifyTimeout(...)=

@rramkumar1
Copy link
Contributor

/hold

We can only merge this PR once we cut a new Ingress-GCE version. Thanks for the work!

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 24, 2018
@rramkumar1
Copy link
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 2, 2018
@rramkumar1
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 2, 2018
@rramkumar1
Copy link
Contributor

@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.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2018
Test draining timeouts changes/transitions.
@bpineau
Copy link
Contributor Author

bpineau commented Nov 4, 2018

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
Copy link
Contributor

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.

@rramkumar1
Copy link
Contributor

@bpineau Also can you please squash commits?

@rramkumar1
Copy link
Contributor

@bpineau friendly ping

@rramkumar1
Copy link
Contributor

/lgtm

Let's just get this in, we can clean up the internals of the test later.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 19, 2018
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 4b124a2 into kubernetes:master Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants