Skip to content

chore(e2e): reduce log noise from kubectl output#281

Open
amuraru wants to merge 3 commits into
masterfrom
reduce-e2e-log-noise
Open

chore(e2e): reduce log noise from kubectl output#281
amuraru wants to merge 3 commits into
masterfrom
reduce-e2e-log-noise

Conversation

@amuraru

@amuraru amuraru commented Jul 14, 2026

Copy link
Copy Markdown

Terratest echoes every stdout line of the kubectl commands it runs. Two spots dominated e2e log volume:

  • listK8sResourceKinds — dumped ~100+ api-resources names per call, twice per cluster snapshot.
  • getBrokerConfigMapLogDirs — dumped the full broker-config ConfigMap for all 3 brokers on every multi-disk-removal poll iteration.

Both now use the existing runKubectlSilent bypass. The multi-disk poller additionally logs only the parsed log.dirs, which is all it inspects.

Also removes the dead setupReducedLogging(): its TEST_LOG_LEVEL / KUBECTL_* env vars have no effect on terratest v1.0.1's logger, which is why the line-dumping persisted.

No behavior change — runKubectlSilent replicates terratest's context/config/namespace handling and error propagation. Verified with go build/go vet -tags e2e; runtime reduction to be confirmed by e2e CI.

🤖 Generated with Claude Code

amuraru and others added 3 commits July 14, 2026 11:48
Terratest echoes every stdout line of the kubectl commands it runs. Two
spots dominated the e2e log volume:

- listK8sResourceKinds dumped ~100+ api-resource names per call, twice
  per cluster snapshot.
- getBrokerConfigMapLogDirs dumped the full broker-config ConfigMap for
  all 3 brokers on every multi-disk-removal poll iteration.

Both now use the existing runKubectlSilent bypass. The multi-disk poller
additionally logs only the parsed log.dirs, which is all it inspects.

Also removes the dead setupReducedLogging(): its TEST_LOG_LEVEL /
KUBECTL_* env vars have no effect on terratest v1.0.1's logger, which is
why the line-dumping persisted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
runKubectlSilent uses cmd.Output(), which preserves kubectl's trailing
newline (terratest's runner stripped it). listK8sResourceKinds split on
"\n" without trimming, producing an empty-string kind element that got
joined into the `kubectl get` args during cluster snapshotting:

  error: the server doesn't have a resource type ""

TrimRight the trailing newline before splitting, matching getK8sResources
and getK8sResourcesQuiet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
listK8sCRDs split kubectl output on "\n" without trimming the trailing
newline and without dropping warning lines - the same latent bug fixed
in listK8sResourceKinds. It currently uses terratest's runner (which
strips the trailing newline) so it isn't broken today, but it would
break the moment it's switched to runKubectlSilent.

TrimRight the trailing newline, guard empty output, and run
kubectlRemoveWarnings - consistent with getK8sResources and
getK8sResourcesQuiet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants