chore(e2e): reduce log noise from kubectl output#281
Open
amuraru wants to merge 3 commits into
Open
Conversation
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>
dobrerazvan
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Terratest echoes every stdout line of the kubectl commands it runs. Two spots dominated e2e log volume:
listK8sResourceKinds— dumped ~100+api-resourcesnames per call, twice per cluster snapshot.getBrokerConfigMapLogDirs— dumped the fullbroker-configConfigMap for all 3 brokers on every multi-disk-removal poll iteration.Both now use the existing
runKubectlSilentbypass. The multi-disk poller additionally logs only the parsedlog.dirs, which is all it inspects.Also removes the dead
setupReducedLogging(): itsTEST_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 —
runKubectlSilentreplicates terratest's context/config/namespace handling and error propagation. Verified withgo build/go vet -tags e2e; runtime reduction to be confirmed by e2e CI.🤖 Generated with Claude Code