add unit tests for getRuntimeString - #2831
Conversation
Signed-off-by: Yashraj Shukla <shuklayashraj68@gmail.com>
📝 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.
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.