-
Notifications
You must be signed in to change notification settings - Fork 51
Feat/add unit tests #395
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
base: main
Are you sure you want to change the base?
Feat/add unit tests #395
Conversation
Signed-off-by: Mysterio-17 <mradultiwari1708@gmail.com>
Signed-off-by: Mysterio-17 <mradultiwari1708@gmail.com>
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hello @Mysterio-17 , this PR also has changes from the netkit PR. These are two different PRs and the same changes should not be present in both PRs. Please remove the netkit changes from this PR and take a look in the contribution guide |
3f4bf6d to
31a2818
Compare
This PR should only contain unit test additions. The netkit-related changes (network_netkit_test.go, netkit support functions, and dictionary updates) have been removed to keep the PR focused on unit tests only. Signed-off-by: Mradul Tiwari <mradultiwari1708@gmail.com>
31a2818 to
24d5f9f
Compare
|
Hello @cmainas , I’ve removed all netkit-related changes from this PR as suggested, and it now includes only unit test additions. All tests pass successfully, and the commit message has been updated to follow the contribution guidelines. |
cmainas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Mysterio-17 ,
thank you for this contribution. I have various comments:
- Please use a different method to verify the return values and errors (e.g. assert package) as we do here https://github.com/urunc-dev/urunc/blob/main/pkg/unikontainers/config_test.go. It makes the code cleaner and easier to read for a unit test
- Replace
wantwithexpect
- Use assert package for cleaner assertions (config_test.go style) - Simplify redundant test cases and use constants - Rename hypervisor to monitor in vaccel tests - Add t.Parallel() for parallel test execution Signed-off-by: Mradul Tiwari <mradultiwari1708@gmail.com>
|
Hello @cmainas,
All tests are passing now. Please let me know if any further changes are needed. |
Add Unit Tests for Vaccel, Network Utils, and Rootfs Selection
Fixes: #96
This PR adds comprehensive unit tests for previously untested functions in the urunc codebase, improving overall test coverage.
Tests Added
pkg/unikontainers/vaccel_test.go (2 test functions, 15 test cases)
TestIdToGuestCID- 4 test cases for deterministic vAccel guest CID generation from container IDsTestIsValidVSockAddress- 11 test cases validating vsock addresses for qemu (vsock://) and firecracker (unix://) formatspkg/unikontainers/rootfs_test.go (3 test functions, 14 test cases)
TestNewRootfsResult- 4 test cases for rootfs result creation (initrd, block, 9pfs, empty)TestRootfsSelector_TryInitrd- 3 test cases for annotation-based initrd path detectionTestRootfsSelector_ShouldMountContainerRootfs- 7 test cases for boolean parsing (true/1/false/0/invalid/empty values)pkg/network/network_test.go (3 test functions, 7 test cases)
TestGetTapIndex- Tests TAP device index extraction from interface namesTestNewNetworkManager- 5 test cases for network manager factory pattern (static/dynamic/invalid)TestEnsureEth0Exists- Tests eth0 interface existence validationSummary