-
Notifications
You must be signed in to change notification settings - Fork 247
test: improve test logging #7841
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
Conversation
516defd to
9cbd299
Compare
9cbd299 to
9b3fb2c
Compare
9b3fb2c to
ce08c4c
Compare
- Add elapsed timestamps to test log output via testLogger wrapper - Add LogStep helpers that log → start / ✓ done / ✗ failed with timing - Add LogStep to major operations: cluster, VMSS, node/pod wait, ACR, etc. - Remove redundant log lines while keeping skip-reason messages - Fix ##vso wrappers: split into readable + ADO command - Fix LogDuration to always log, emit ##vso only when over threshold - Fix typo isAnonyomusPull → isNonAnonymousPull - Replace logf/log aliases with direct toolkit.Logf/Log calls
ce08c4c to
2692766
Compare
954be71 to
17d4b6d
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.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
e2e/test_helpers.go
Outdated
| var ( | ||
| logf = toolkit.Logf | ||
| log = toolkit.Log | ||
| // removed logf and log aliases - use toolkit.Logf and toolkit.Log directly | ||
| ) |
Copilot
AI
Feb 10, 2026
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 var block is now empty, which is invalid Go syntax and will fail compilation. Remove the block entirely (or replace it with a regular comment outside of a var block).
e2e/kube.go
Outdated
|
|
||
| func (k *Kubeclient) createKubernetesSecret(ctx context.Context, namespace, secretName, registryName, username, password string) error { | ||
| logf(ctx, "Creating Kubernetes secret %s in namespace %s", secretName, namespace) | ||
| toolkit.LogStepCtxf(ctx, "creating kubernetes secret %s in namespace %s for registry %s", secretName, namespace, registryName)() |
Copilot
AI
Feb 10, 2026
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.
LogStepCtxf(... )() is invoked immediately here rather than being deferred, so it will log "done" before the secret creation has actually completed (and it won’t reflect failures). Use defer with the returned function so the end status/timing reflects the whole operation.
| toolkit.LogStepCtxf(ctx, "creating kubernetes secret %s in namespace %s for registry %s", secretName, namespace, registryName)() | |
| done := toolkit.LogStepCtxf(ctx, "creating kubernetes secret %s in namespace %s for registry %s", secretName, namespace, registryName) | |
| defer done() |
| func LogDuration(ctx context.Context, duration time.Duration, warningDuration time.Duration, message string) { | ||
| Log(ctx, message) | ||
| if duration > warningDuration { | ||
| Logf(ctx, "⚠️ ##vso[task.logissue type=warning;] %s", message) | ||
| } else { | ||
| Log(ctx, message) | ||
| Logf(ctx, "##vso[task.logissue type=warning;]%s", message) | ||
| } |
Copilot
AI
Feb 10, 2026
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.
LogDuration now always logs message and then logs the same message again as an Azure DevOps warning when the threshold is exceeded, which can create duplicate lines in test output. Consider logging only once in the warning case (either emit only the ##vso[...] line, or keep the normal log and use a shorter warning message).
testLoggerwrapperLogStephelpers that log→ msg...at start and✓ done (Xs)or✗ failed (Xs)on completion via deferlogf/logpackage-level aliases with directtoolkit.Logf/toolkit.Logcalls to remove it from log stacktrace