Skip to content

[Testing]: Add unit test coverage for Unikraft version parsing and boot commandline generation #918

Description

@ParthMozarkar

Summary

pkg/unikontainers/unikernels/unikraft.go is the core handler for Unikraft, the primary unikernel OS supported by urunc. It manages boot argument construction based on Unikraft versioning (< 0.16.1 legacy compatibility vs. modern vfs.fstab, netdev.ip, env.vars).

While sibling files mirage_test.go and mewz_test.go exist, unikraft.go currently has zero unit tests. Any regression in version parsing or command-line generation could break Unikraft container deployments in Kubernetes/containerd.

Expected Behavior

pkg/unikontainers/unikernels should include a unikraft_test.go test suite that verifies:

  1. Version fallback logic (ErrUndefinedVersion, ErrVersionParsing, version >= 0.16.1 vs < 0.16.1).
  2. Boot command line generation via CommandString() (environment variables env.vars=[ ... ], console string, network IP string, rootfs vfs.fstab).
  3. File system support (SupportsFS("9pfs")) and block support (SupportsBlock()).

Proposed Changes

  • Create pkg/unikontainers/unikernels/unikraft_test.go with table-driven tests covering modern/legacy Unikraft versions, architecture-specific console settings (arm64 vs amd64), and error cases.

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