Skip to content
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

capture klog output without SetBuffer #317

Closed
pohly opened this issue Mar 28, 2022 · 1 comment · Fixed by #327
Closed

capture klog output without SetBuffer #317

pohly opened this issue Mar 28, 2022 · 1 comment · Fixed by #327
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@pohly
Copy link

pohly commented Mar 28, 2022

/kind feature

Describe the solution you'd like

There are several unit tests which temporarily use SetBuffer to capture log output. There have been several cases where this led to race conditions:

Once we have contextual logging and the code under test supports it, SetBuffer can be removed and get replaced with a logger that writes into a byte.Buffer. Such tests then can run in parallel.

In klog we can provide such a logger. This has the advantage that the output format will be familiar.

Another alternative is a logger that captures the raw Info and Error parameters without formatting them. This may or may not be easier to test against.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 28, 2022
@pohly
Copy link
Author

pohly commented Jun 10, 2022

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants