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

pkg/blobcache: simplify test case #2521

Merged
merged 1 commit into from
Aug 15, 2024
Merged

Conversation

kolyshkin
Copy link
Contributor

Based on a patch from #2512.


  1. Use os.ReadDir to remove a few lines of code.

  2. Don't wrap errors from os, they already contain file name.

1. Use os.ReadDir to remove a few lines of code.

2. Don't wrap errors from os, they already contain file name.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin
Copy link
Contributor Author

2. Don't wrap errors from os, they already contain file name.

From the review comments in #2515 I found out we want to keep wrapping os errors, since the file name component in os.PathError is not being quoted when converting to a string. Yet this is a test case code, in which file names are predictable, and all errors have additional context (source file name and line number), which makes it easier to figure out what has happened, so I took the liberty of keeping the part of the original patch which removes os error wrapping.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

@mtrmac
Copy link
Collaborator

mtrmac commented Aug 15, 2024

so I took the liberty of keeping the part of the original patch which removes os error wrapping.

ACK. (Really the typical c/image approach is to use {assert,require}.NoError instead of directly using testing.T.{Fail,Fatal}*, but this file has a longer history from outside the project. And we are not wrapping the errors in NoError either.)

@mtrmac mtrmac merged commit 258250c into containers:main Aug 15, 2024
10 checks passed
@kolyshkin kolyshkin deleted the blobcache branch August 16, 2024 11:54
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