test: improve Eventually() polling diagnostics in cluster TLS endpoint test#5999
test: improve Eventually() polling diagnostics in cluster TLS endpoint test#5999aklymenk wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aklymenk The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
This PR improves diagnostics in the cluster_tls_endpoints E2E test by adding delta-only logging during Eventually() polling and by switching a console URL wait from a bool predicate to an error predicate so timeouts are more descriptive.
Changes:
- Added delta-only logging for API certificate polling so stuck polling surfaces the current blocking error.
- Converted the console URL wait to
Eventually(func() error)with delta-only logging and a clearer Gomega timeout message. - Reduced ingress certificate polling log spam by logging issuer changes only, and added a deferred final-state summary log.
3433754 to
bd20d03
Compare
bd20d03 to
a4d8ef0
Compare
|
/test ? |
|
/test integration-e2e-parallel |
…t test The ingress-cert Eventually() block logged the same issuer line on every poll regardless of whether anything changed. The API-cert and console-URL Eventually() blocks had the opposite problem: completely silent while polling, giving zero visibility if they got stuck. - Ingress cert check: track last-seen issuer and error, log only on first observation or change, plus a guaranteed final-state summary via defer. - API cert check: same delta-only logging, added for visibility that didn't exist before. - Console URL wait: same delta-only logging, plus converted from a bool-returning closure to error-returning so Gomega's own timeout message is now descriptive instead of "Expected <bool>: false to be true".
a4d8ef0 to
e81a8a9
Compare
|
|
||
| By("examining the server certificate returned by the default ingress when routing the console URL") | ||
| // Wait for the certificate to be loaded after console starts | ||
| consoleUrlWithPort := fmt.Sprintf("%s:%d", consoleURL, 443) |
|
/test integration-e2e-parallel |
|
@aklymenk: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
| Eventually(func() error { | ||
| var lastIngressIssuer, lastIngressErr string | ||
| defer func() { | ||
| GinkgoLogr.Info("Ingress certificate final state", "issuer", lastIngressIssuer, "error", lastIngressErr) |
There was a problem hiding this comment.
Add a check to see if lastIngressErr is not empty here, otherwise we would be logging an empty error message we don't need. See line 166. Maybe something like:
defer func() {
kv := []any{"issuer", lastIngressIssuer}
if lastIngressErr != "" {
kv = append(kv, "error", lastIngressErr)
}
GinkgoLogr.Info("Ingress certificate final state", kv...)
}()
What
Improves logging across all three
Eventually()polling loops incluster_tls_endpoints.go:defer(as suggested here).defer— unlike the ingress one, this only fires when there's an actual error to report, since success is already marked by the existing interior log.Expected success, but got an error: ...) instead of the genericExpected <bool>: false to be true; adds the same delta-only logging plus the same conditional final-state summary viadefer; removes a deadExpect(...).NotTo(BeNil())check that could never fail given the preceding guard clause.ctx context.Contextand call.WithContext(ctx). This lets Gomega's own polling loop react to external context cancellation with a clean "Context was cancelled" failure instead of grinding through its full timeout budget regardless.Why
Ingress-cert loop loggs the same issuer line on every poll regardless of whether anything changed (example of 'bad' output can be found here. Investigating further surfaced that the other two loops had the opposite problem: they were silent while polling, giving zero visibility into what was blocking them until either success or the final timeout. A second round of review also pointed out these loops weren't context-aware, meaning they couldn't respond to external cancellation cleanly. This PR addresses all three issues so the test's diagnostics accurately reflect what's happening during a 10-15 minute wait.
Testing
This PR modifies logging/diagnostics/cancellation behavior in an existing E2E test rather than adding new test coverage, so.
PR Checklist