-
Notifications
You must be signed in to change notification settings - Fork 39k
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 retrying to audit logging e2e tests #60794
Add retrying to audit logging e2e tests #60794
Conversation
fdc9b86
to
e71edcc
Compare
[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process @crassirostris @liggitt @sttts @tallclair Pull Request Labels
|
e71edcc
to
cbbc4d7
Compare
test/e2e/auth/audit.go
Outdated
@@ -35,12 +36,18 @@ import ( | |||
|
|||
"github.com/evanphx/json-patch" | |||
. "github.com/onsi/ginkgo" | |||
. "github.com/onsi/gomega" | |||
"k8s.io/apimachinery/pkg/util/wait" |
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.
nit: order
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
test/e2e/auth/audit.go
Outdated
auditTestUser = "kubecfg" | ||
|
||
pollingInterval = 30 * time.Second | ||
pollingTimeout = 5 * time.Minute |
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 we inline these everywhere else?
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
test/e2e/auth/audit.go
Outdated
@@ -630,7 +637,14 @@ var _ = SIGDescribe("Advanced Audit", func() { | |||
expectedEvents = append(expectedEvents, t.events...) | |||
} | |||
|
|||
expectAuditLines(f, expectedEvents) | |||
err = wait.Poll(pollingInterval, pollingTimeout, func() (bool, 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.
do we have any guarantees about the times?
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.
Added a comment
test/e2e/auth/audit.go
Outdated
@@ -648,33 +662,44 @@ type auditEvent struct { | |||
} | |||
|
|||
// Search the audit log for the expected audit lines. | |||
func expectAuditLines(f *framework.Framework, expected []auditEvent) { | |||
func expectAuditLines(f *framework.Framework, expected []auditEvent) (bool, 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.
should be called searchAuditLines
or something like that. Expect implies that it fails on errors.
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
cbbc4d7
to
fb24b10
Compare
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, PTAL
test/e2e/auth/audit.go
Outdated
@@ -35,12 +36,18 @@ import ( | |||
|
|||
"github.com/evanphx/json-patch" | |||
. "github.com/onsi/ginkgo" | |||
. "github.com/onsi/gomega" | |||
"k8s.io/apimachinery/pkg/util/wait" |
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
test/e2e/auth/audit.go
Outdated
auditTestUser = "kubecfg" | ||
|
||
pollingInterval = 30 * time.Second | ||
pollingTimeout = 5 * time.Minute |
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
test/e2e/auth/audit.go
Outdated
@@ -630,7 +637,14 @@ var _ = SIGDescribe("Advanced Audit", func() { | |||
expectedEvents = append(expectedEvents, t.events...) | |||
} | |||
|
|||
expectAuditLines(f, expectedEvents) | |||
err = wait.Poll(pollingInterval, pollingTimeout, func() (bool, 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.
Added a comment
test/e2e/auth/audit.go
Outdated
@@ -648,33 +662,44 @@ type auditEvent struct { | |||
} | |||
|
|||
// Search the audit log for the expected audit lines. | |||
func expectAuditLines(f *framework.Framework, expected []auditEvent) { | |||
func expectAuditLines(f *framework.Framework, expected []auditEvent) (bool, 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.
Done
test/e2e/auth/audit.go
Outdated
@@ -630,7 +631,18 @@ var _ = SIGDescribe("Advanced Audit", func() { | |||
expectedEvents = append(expectedEvents, t.events...) | |||
} | |||
|
|||
expectAuditLines(f, expectedEvents) | |||
// The default flush timeout is 30 seconds, therefore 5 minutes should be enough to wait 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.
What I really meant with my previous comment: don't we flush regularly even in batched mode? 5min sounds a lot.
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.
Sorry, I clarified the comment: we're waiting for 5 minutes to avoid flakes, in most cases, one retry (30 seconds) should be enough
Signed-off-by: Mik Vyatskov <vmik@google.com>
fb24b10
to
f327a2a
Compare
/lgtm To fix the flakes. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: crassirostris, sttts 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
/retest |
Automatic merge from submit-queue (batch tested with PRs 60630, 60794). If you want to cherry-pick this change to another branch, please follow the instructions here. |
…-#60794-upstream-release-1.9 Automatic merge from submit-queue. Automated cherry pick of #60794: Add retrying to audit logging e2e tests Cherry pick of #60794 on release-1.9. Fixes #60719, since audit logging behavior has changed in 1.10. Purely e2e change, so no release note #60794: Add retrying to audit logging e2e tests ```release-note NONE ``` /cc @sttts @liggitt
Fixes #60719
Adds retrying to the audit logging e2e tests so it can work when audit logging is in batch mode and actual writing is delayed.
/cc @tallclair @liggitt @sttts