-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Move ConfigMap updating methods into e2e/framework #2346
Move ConfigMap updating methods into e2e/framework #2346
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@k8s-ci-robot yo i signed |
@andrewlouis93 thank you for doing this. |
This is a great idea. Maybe this would enable to run the e2e tests in parallel? (the issue now is being fixed in this PR) |
Definitely 🙌 Would love to drive down that ~15 minute run. |
Codecov Report
@@ Coverage Diff @@
## master #2346 +/- ##
=========================================
- Coverage 39.12% 39.1% -0.02%
=========================================
Files 73 73
Lines 5204 5204
=========================================
- Hits 2036 2035 -1
- Misses 2878 2880 +2
+ Partials 290 289 -1
Continue to review full report at Codecov.
|
test/e2e/framework/framework.go
Outdated
return nil, err | ||
} | ||
|
||
time.Sleep(1 * time.Second) |
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.
why do you need to sleep here?
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.
Leftover from building off of the update method! Nice catch, will delete :)
test/e2e/framework/framework.go
Outdated
@@ -259,6 +259,80 @@ func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) b | |||
} | |||
} | |||
|
|||
// GetNginxConfigMap gets ingress-nginx's nginx-configuration map | |||
func (f *Framework) GetNginxConfigMap() (*v1.ConfigMap, 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.
this function does not seem to be used in anywhere else outside of this package, IMHO we should not export it
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'm not sure I feel strongly about doing that since even if we don't namesapce this method to the framework struct, the methods are still usable in the tests. For example, see how UpdateDeployment
is used here: https://github.com/kubernetes/ingress-nginx/blob/master/test/e2e/lua/dynamic_configuration.go#L89.
The benefit of namespacing it to framework is that we wouldn't need to pass in a KubeClientSet
like we need to when calling UpdateDeployment
. Let me know what you think
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.
@andrewlouis93 I just meant declare it as a private function i.e
func (f *Framework) getNginxConfigMap()
that way you could also delete the comment
--
but really not important - I don't mind if you leave this as it is
test/e2e/framework/framework.go
Outdated
return err | ||
} | ||
|
||
if config == 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.
Under what circumstances can this be nil
while err
is nil
too?
0a9977a
to
ba402be
Compare
bi := buildBasicAuthIngressWithSecondPath(host, f.Namespace.Name, s.Name, noAuthPath) | ||
ing, err := f.EnsureIngress(bi) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(ing).NotTo(BeNil()) | ||
|
||
if defaultNginxConfigMapData == 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.
Why not just revert updateConfigmap(setting, noAuthPath, f.KubeClientSet)
with updateConfigmap(setting, "", f.KubeClientSet)
in AfterEach
instead of introducing a new logic? If we want to be more restrictive we can also always reset configmap at https://github.com/kubernetes/ingress-nginx/blob/master/test/e2e/framework/framework.go#L107
I suggest
|
@andrewlouis93 please rebase |
…fault nginx-configuration state between tests Group sublogic
e2501ec
to
8d479bd
Compare
bi := buildBasicAuthIngressWithSecondPath(host, f.Namespace.Name, s.Name, noAuthPath) | ||
ing, err := f.EnsureIngress(bi) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(ing).NotTo(BeNil()) | ||
|
||
err = f.UpdateNginxConfigMapData(setting, noAuthPath) |
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.
any specific reason you move this down below EnsureIngress?
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.
No reason here, could move it back up
@@ -41,16 +39,19 @@ var _ = framework.IngressNginxDescribe("Proxy Protocol", func() { | |||
BeforeEach(func() { | |||
err := f.NewEchoDeployment() | |||
Expect(err).NotTo(HaveOccurred()) | |||
|
|||
err = f.UpdateNginxConfigMapData(setting, "false") | |||
Expect(err).NotTo(HaveOccurred()) |
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.
Why is this necessary? I could not find the corresponding updateConfigmap
for this
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.
It's happening in the AfterEach handler in the current implementation: https://github.com/kubernetes/ingress-nginx/pull/2346/files#diff-271db20be8cbad3b37eafe10f4eacbcfL47
It seems like the test writer just wanted to default the setting to false
on all tests, and explicitly set true
at the beginning of tests where needed - so thought it was appropriate to move it into the Before handler.
@@ -210,6 +210,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() { | |||
return err | |||
}) | |||
Expect(err).NotTo(HaveOccurred()) | |||
time.Sleep(5 * time.Second) |
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.
Without this, the test is sometimes run with only 1 replica - since it doesn't wait for the 2nd replica to spin up.
The only time it would work is when this test is run before this current test - since already 2 replicas are available at that point. Shout out to @zrdaley for helping troubleshoot this flaky test :)
Should invest in putting together the ephemeral ingresses for each test - otherwise the e2e tests will being to get flaky very quickly.
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.
@andrewlouis93 maybe you can use something like this to wait for the replica count you expect
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.
Hmm interesting.
So this sleep is actually happening right after an UpdateDeployment
incantation: https://github.com/kubernetes/ingress-nginx/pull/2346/files#diff-8700c46a8379c603b5e41ccbaff6b71eR206
But it didn't seem like the number of replicas was updated. Will take a closer look.
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.
@andrewlouis93 that should return early only if there is an error updating the deployment
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.
Yeah I figured as much, edited my comment. Will take a closer look, but feel free to go ahead and approve - I think I'm satisfied with the state its in right now.
Stylistic fixes based on feedback
5b58de8
to
882a99c
Compare
@andrewlouis93 after we merge this PR I will review all the timeouts in the tests and fix the random behavior |
Sounds good, happy to give you a hand and keep looking into it as well :) |
/lgtm |
/approve |
@andrewlouis93 thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, andrewlouis93 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 |
@andrewlouis93 just in case we will start requesting squashed commits in PRs |
Sounds good, will do it moving forwards :) Making some headway on looking into that bug we're patching by sleeping. The rabbit hole is deep 🐇 |
@andrewlouis93 #2374 |
What this PR does / why we need it:
ingress-nginx/test/e2e/settings/no_auth_locations.go
Line 63 in 361e53f
TL;DR: The way the nginx-configuration configMap is updated and reset in the e2e tests leaks state! Issa fix.
Special notes for your reviewer:
Let me know what you guys think - happy to iterate or rework this.
cc @ElvinEfendi @zrdaley