Skip to content

refactor(e2e): log through a Logger interface instead of testing.TB - #9280

Merged
r2k1 merged 1 commit into
mainfrom
r2k1-e2e-logger-boundary
Aug 25, 2026
Merged

refactor(e2e): log through a Logger interface instead of testing.TB#9280
r2k1 merged 1 commit into
mainfrom
r2k1-e2e-logger-boundary

Conversation

@r2k1

@r2k1 r2k1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Remove explicit calls to *testing.T for logging. Preparation to move away from go testing for E2E.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   13 suites   1m 8s ⏱️
404 tests 404 ✅ 0 💤 0 ❌
407 runs  407 ✅ 0 💤 0 ❌

Results for commit 06c19a1.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors E2E logging behind a minimal Logger interface while retaining testing.TB only for explicit test control, complementing #9262’s cleanup boundary.

Changes:

  • Introduces context-aware test and standard loggers with failure formatting.
  • Migrates scenario helpers and validators from testing.TB logging.
  • Adds tests for logger capabilities, fallback behavior, formatting, and artifact naming.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
e2e/vmss.go Migrates VMSS logging and artifact naming.
e2e/validators.go Migrates validator logging and removes helper calls.
e2e/validators_kata.go Migrates Kata validator logging.
e2e/validation.go Migrates common validation logging.
e2e/validate_localdns_exporter_metrics.go Migrates LocalDNS exporter logging.
e2e/types.go Adds scenario logger and test name fields.
e2e/toolkit/strings.go Uses context logger for duration logs.
e2e/toolkit/log.go Defines logger abstractions and failure formatting.
e2e/toolkit/log_test.go Tests logger boundaries and formatting.
e2e/test_helpers.go Initializes loggers at the runner boundary.
e2e/scenario_gpu_managed_experience_test.go Migrates GPU scenario logging.
e2e/scenario_gpu_daemonset_test.go Migrates daemon-set scenario logging.
e2e/log.go Decouples artifact helpers from testing.TB.
e2e/log_test.go Tests artifact paths and VMSS names.
e2e/kube.go Migrates node readiness logging.
e2e/exec.go Migrates command diagnostic logging.
e2e/cse_timing.go Migrates timing report logging.
e2e/config/azure_vmext_test.go Updates tests to use context loggers.
e2e/artifact_streaming.go Migrates artifact-streaming diagnostics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread e2e/toolkit/log.go
}

func (l *testLogger) Log(args ...any) {
l.tb.Helper()
@r2k1

r2k1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

CI triage: Agentbaker GPU E2E (build 177588270) is red for a pre-existing reason, not this PR.

Only Test_Ubuntu2404_NvidiaDevicePluginRunning_MIG_MultiGPU fails (3 runs, 3 failures). Root cause is StandardNCADSA100v4Family core quota exhaustion in WestUS3: the A100 scenarios run in parallel and need 144 cores against a limit of 100. When the VMSS PUT is rejected synchronously the scenario skips and the build is green; when the PUT is accepted but the instance never allocates, the VMSS exists with no ID or tags, the VM never boots, and the failure surfaces as five bastion SSH handshake timeouts. Boot diagnostics for the failing VM return BlobNotFound, while every passing GPU scenario in the same run has a full serial console.

The same scenario fails identically on main: builds 177574607, 177446225, 177400259, 177383459, 177365480, 177174586 — 6 of 6, same bastionssh.go:304/:323 retry ladder and same vmss.go:525 no-tags line.

This PR cannot be the cause. bastionssh.go and cluster.go are not in the diff, the failing test at scenario_gpu_managed_experience_test.go:736 is untouched (the only hunks in that file are inside Test_DCGM_Exporter_Compatibility, lines 305-390), and no product code changed. Agentbaker E2E (177588266) and Agentbaker Windows E2E (177588268) pass on the same commit.

Worth a separate repair item: raise the WestUS3 A100 quota or serialize the A100 scenarios, and fail fast when a VMSS comes back with no ID instead of burning ~200s on doomed bastion handshakes.

E2E implementation code logged through testing.TB, which gave every
validator and helper the power to fail, skip or rename the test. The
context also carried a testing.TB, so the capability reached anything
holding a context.

Introduce toolkit.Logger, an interface with Log and Logf only. testLogger
holds the testing.TB in an unexported field instead of embedding it, so
no test-control method leaks. ContextWithT is replaced by
ContextWithLogger, and the context now carries a Logger. Scenario gains a
Logger field, and the ~200 direct s.T.Log/s.T.Logf call sites use it. The
149 s.T.Helper() calls only shaped log attribution, so they are removed;
the logger marks its own frames instead. Artifact path helpers take an
explicit test name rather than a testing.TB.

Test control stays explicit at the runner boundary. Scenario.T remains
for Error, Failed, Skip, Name, Run and Cleanup, and the failure
decoration moves to toolkit.WithFailureFormatting, a testing.TB
decorator.

Log text, elapsed timing, step markers, failure diagnostics and log line
attribution are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 25, 2026 03:36
@r2k1
r2k1 force-pushed the r2k1-e2e-logger-boundary branch from c9f9b74 to 06c19a1 Compare August 25, 2026 03:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 19 out of 19 changed files in this pull request and generated no new comments.

@r2k1
r2k1 merged commit 483d071 into main Aug 25, 2026
25 of 26 checks passed
@r2k1
r2k1 deleted the r2k1-e2e-logger-boundary branch August 25, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants