Skip to content

test(hypervisors/firecracker): Add unit test suite for Firecracker config generation - #949

Draft
safiya2610 wants to merge 1 commit into
urunc-dev:mainfrom
safiya2610:test/firecracker-unit-tests
Draft

test(hypervisors/firecracker): Add unit test suite for Firecracker config generation#949
safiya2610 wants to merge 1 commit into
urunc-dev:mainfrom
safiya2610:test/firecracker-unit-tests

Conversation

@safiya2610

Copy link
Copy Markdown

Problem

The Firecracker hypervisor implementation in pkg/unikontainers/hypervisors/firecracker.go currently lacks unit test coverage. Since Firecracker dynamically generates a JSON configuration file (config.json) containing settings for boot-source, machine-config, network-interfaces, and drives, a comprehensive unit test suite is needed to ensure these configurations and the resulting CLI arguments are correctly generated without regressions.

Summary

This PR introduces a comprehensive table-driven unit test suite (firecracker_test.go) for the Firecracker driver.

Changes include:

  • TestFirecrackerBuildExecCmd: Verifies ExecCommand() by parsing the JSON file generated in /tmp/ and ensuring proper translation of:
    • vcpu and memory parameters into the machine-config.
    • MonitorNetArgs into network-interfaces (including mac and host_dev_name).
    • MonitorBlockArgs into drives (including correct is_root_device and is_read_only states).
    • Proper generation of the CLI command with --no-api and --config-file.
  • TestFirecrackerProperties: Verifies that Firecracker properly returns capabilities like UsesKVM() and ignores unsupported SharedFS parameters.

Testing

  • Tested locally via go test -v ./pkg/unikontainers/hypervisors/...
  • Validated that go build does not break.

Linked Issues

Fixes: #948

…nfig generation

Signed-off-by: safiya2610 <lci2023053@iiitl.ac.in>
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 3d3dbbf
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a7ab3a87c294e0008860e69

@cmainas cmainas added invalid This doesn't seem right do-not-merge labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(hypervisors/firecracker): Add unit test suite for Firecracker config generation

2 participants