add unit tests for getRuntimeString - #2831
Conversation
📝 WalkthroughWalkthroughAdded Merge Risk: ⚪ Minimal · up to This PR only adds unit tests and does not change production behavior. An error-path assertion could be strengthened, but no actionable merge-blocking risk remains. Comment |
There was a problem hiding this comment.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
🟡 Other comments (1)
controllers/clusterinfo/clusterinfo_test.go-74-76 (1)
74-76: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert the returned value for error cases.
The error branch checks only
errand returns. IfgetRuntimeStringreturns a non-empty runtime with an error, these subtests still pass. Assert thatresultis empty before returning.Proposed fix
if tc.expectError { require.Error(t, err) + require.Empty(t, result) return }Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: QUIET
Plan: Enterprise
Run ID: c075bd47-7526-4e5d-929b-dc62cee21e25
📒 Files selected for processing (1)
controllers/clusterinfo/clusterinfo_test.go
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.
|
/ok to test d8b1d0b |
|
Thanks for your contribution @yashrajshuklaaa ! Please ensure that your commits are signed. See here |
|
@tariq1890 DCO signed already. |
|
@yashrajshuklaaa could you fold in the comment removal changes from your other PR here. #2832 |
|
@kvalliyurnatt sure |
d8b1d0b to
8e690a3
Compare
|
@kvalliyurnatt done! |
|
@yashrajshuklaaa commit sign off and commit signing are two different things. Very easy to confuse the two, so I don't blame you! I am referring to signing your commits with a GPG signature. After you do this, the your commit will also show up as
Please refer to this link to get started with signed commits. |
Signed-off-by: Yashraj Shukla <shuklayashraj68@gmail.com>
8e690a3 to
316161a
Compare
|
@tariq1890 done! I was a bit confused between DCO and commit signing. Thanks for pointing me in the right direction! |
|
/ok to test 316161a |
|
Thanks |

Description
Adds unit tests for
getRuntimeString(docker, containerd, cri-o and error cases). First test file for theclusterinfopackagewhich had 0% coverage. Now at 5.4%.
Testing
go test ./controllers/clusterinfo/... -v -cover. All 5 subtests pass.