Skip to content

test(unikernels): guest implementations have no unit tests, package at 9.5% coverage #934

Description

@HARSHRAJ2789

The pkg/unikontainers/unikernels package sits at 9.5% statement coverage. mirage.go and mewz.go have test files, and the rest of the guest implementations have none.

Uncovered functions per file, from go tool cover -func:

File Functions at 0.0% Test file
linux.go 13 none
unikraft.go 9 none (being addressed in #921)
rumprun.go 8 none
hermit_rs.go 8 none
mewz.go 7 partial
mirage.go 4 partial

I would like to start with rumprun.go. It is the guest family I have been running while working through the Argo integration in #573, so the cases would come from behaviour I have watched in a cluster.

All eight of its functions are pure, with no I/O or syscalls, which makes them straightforward to cover in the table-driven style already used by mirage_test.go and mewz_test.go:

  • CommandString builds the JSON boot configuration
  • Init maps UnikernelParams onto the struct
  • SupportsFS gates ext2 against other filesystems, which matters because the block rootfs path in rootfs.go:233 depends on it
  • MonitorNetCli, MonitorBlockCli and MonitorCli build monitor arguments
  • SupportsBlock and newRumprun

Recent fixes in this area suggest the cases are worth pinning down. #823 was a subnet mask handled incorrectly in argument construction, and #747 was a redundant monitor branch. Both are the kind of thing a table test catches.

Happy to open a PR for rumprun.go if this is useful, and to follow with linux.go and hermit_rs.go if the approach looks right. Checking first in case the scope is not what you want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions