test(unikernels): add unit test coverage for linux backend#613
Open
theycallmeaabie wants to merge 1 commit intourunc-dev:mainfrom
Open
test(unikernels): add unit test coverage for linux backend#613theycallmeaabie wants to merge 1 commit intourunc-dev:mainfrom
theycallmeaabie wants to merge 1 commit intourunc-dev:mainfrom
Conversation
Signed-off-by: theycallmeaabie <theycallmeaabie@gmail.com>
✅ Deploy Preview for urunc canceled.
|
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated unit test suite for the Linux unikernel backend in pkg/unikontainers/unikernels, aiming to improve confidence in linux.go behavior around boot parameter generation, monitor CLI wiring, urunit config generation, and initialization paths.
Changes:
- Add unit tests for Linux backend helpers such as filesystem support, subnet checks, command-line parsing, and network configuration.
- Add behavior-focused tests for monitor block/CLI argument generation and kernel command-line construction across rootfs and urunit modes.
- Add initialization tests for urunit config creation and selected error propagation paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+513
to
+520
| err := l.Init(types.UnikernelParams{ | ||
| CmdLine: []string{"/usr/bin/urunit"}, | ||
| Rootfs: types.RootfsParams{ | ||
| Type: "initrd", | ||
| MonRootfs: filepath.Join(tmp, "does-not-exist"), | ||
| Path: "initrd.cpio", | ||
| }, | ||
| }) |
Comment on lines
+47
to
+60
| fs string | ||
| want bool | ||
| }{ | ||
| {"ext2", true}, | ||
| {"ext3", true}, | ||
| {"ext4", true}, | ||
| {"9pfs", true}, | ||
| {"virtiofs", true}, | ||
| {"xfs", false}, | ||
| {"btrfs", false}, | ||
| {"", false}, | ||
| } | ||
| for _, c := range cases { | ||
| t.Run(c.fs, func(t *testing.T) { |
Comment on lines
+147
to
+153
| t.Run("surrounding whitespace is trimmed before quoting check", func(t *testing.T) { | ||
| t.Parallel() | ||
| l := &Linux{} | ||
| err := l.parseCmdLine([]string{" /bin/sh ", " -c "}) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, "/bin/sh", l.App) | ||
| assert.Equal(t, "-c", l.Command) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
linux_test.gowith comprehensive unit tests forpkg/unikontainers/unikernels/linux.go.These additions significantly improve test coverage for
linux.go, bringing it to approximately 99%.Related issues
#96
How was this tested?
Tests were executed using:
go test -cover ./pkg/unikontainers/unikernels/...
LLM usage
Gemini 3.1 was used for assistance, all the code is manually reviewed and edited.
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).