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.
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. |
cmainas
left a comment
There was a problem hiding this comment.
Hello @Mysterio-17 ,
thank you for the changes. I have left a few comments. Furthermore, there are two more things that we need to take into consideration:
- We need to add the network_test as a target for init testing in the makefile
- The
isValidSockAddressfunction can change therpcAddressand hence we need to check its value after the call to that function.
- Remove TestGetTapIndex to avoid host-dependent behavior - Use hardcoded expected values in TestIdToGuestCID - Verify rpcAddress modification in TestIsValidVSockAddress - Add test_network target to Makefile Signed-off-by: Mradul Tiwari <mradultiwari1708@gmail.com>
|
Hello @cmainas ,
I've run the tests locally, let me know if any changes are required more |
|
Hello @Mysterio-17 , unfortunately, there are still some linting errors that need to be fixed. |
Signed-off-by: Mradul Tiwari <mradultiwari1708@gmail.com>
418a220 to
5357037
Compare
|
Hi @cmainas , I tried fixing the linting errors locally, kindly run tests once more so that i can check the issues, if any |
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