Skip to content

Conversation

@lilyLuLiu
Copy link
Contributor

@lilyLuLiu lilyLuLiu commented Nov 12, 2025

Summary by CodeRabbit

  • Tests

    • Added a comprehensive end-to-end test suite for the macOS VM provider covering lifecycle, SSH, cloud-init and configuration scenarios.
    • Marked several tests with platform labels (windows, linux, darwin) for selective execution.
  • Chores

    • Updated the e2e test run command to apply platform label filtering so tests can be run per-target OS.

@coderabbitai
Copy link

coderabbitai bot commented Nov 12, 2025

Walkthrough

Adds platform-based Ginkgo label filtering to the e2e Makefile target and introduces/updates end-to-end tests: a new macOS libkrun provider test suite and additional platform labels on existing e2e specs.

Changes

Cohort / File(s) Change Summary
Build configuration
Makefile
Adds --ginkgo.label-filter=$(DEFAULT_GOOS) to the e2e test command (adjusts flag spacing/formatting)
E2E test labeling
test/e2e/setup_test.go, test/e2e/start_test.go, test/e2e/vm_test.go
Adds platform labels (linux, darwin, windows) to Describe/It blocks to enable label-filtered test selection
macOS provider e2e suite
test/e2e/macProvider_test.go
Adds a comprehensive macOS libkrun end-to-end test covering VM init/list/start/ssh, resource configs (CPU/disk/memory), cloud-init, SSH identity, and cleanup/teardown logic

Sequence Diagram(s)

sequenceDiagram
  participant Make as Makefile
  participant G as Ginkgo
  participant T as TestSuite
  participant P as macProvider tests

  Note over Make,G: e2e target runs with platform label filter
  Make->>G: ginkgo --tags e2e --v --ginkgo.label-filter=$(DEFAULT_GOOS)
  G->>T: Select tests matching label (linux/darwin/windows)
  alt macOS selected
    T->>P: Execute `macProvider_test.go` suite
    P->>P: lifecycle: init -> list -> start -> ssh -> verify -> cleanup
  else other platforms
    T->>T: Execute platform-appropriate suites
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus areas for review:
    • test/e2e/macProvider_test.go: setup/teardown correctness, long waits (cloud-init), robust SSH assertions and JSON parsing
    • Makefile change: ensure DEFAULT_GOOS value and flag ordering integrate with CI/runner
    • Label additions: confirm intended test selection and no accidental exclusions

Poem

🐰 I hopped through labels, neat and spry,

darwin, linux—tests nearby.
VMs awake, then softly nap,
SSH tales tucked in my cap.
A carrot-toast for CI's sky. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding comprehensive test cases for darwin/macOS support in the libkrun provider, which is the primary focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
test/e2e/macProvider_test.go (1)

15-201: Consider refactoring to reduce code duplication.

The test logic is nearly identical to setup_test.go, with the main difference being the addition of --provider libkrun flags. Consider introducing helper functions or table-driven tests to reduce duplication and improve maintainability.

Example approach:

  • Extract common test logic into shared helper functions
  • Pass provider name as a parameter
  • Reuse the same test scenarios for both default and libkrun providers

This can be addressed in a future PR if preferred.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46045de and 3d95343.

📒 Files selected for processing (4)
  • Makefile (1 hunks)
  • test/e2e/macProvider_test.go (1 hunks)
  • test/e2e/setup_test.go (1 hunks)
  • test/e2e/start_test.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
test/e2e/setup_test.go (1)
vendor/github.com/onsi/ginkgo/v2/core_dsl.go (1)
  • Describe (514-516)
test/e2e/macProvider_test.go (3)
vendor/github.com/onsi/ginkgo/v2/core_dsl.go (4)
  • Describe (514-516)
  • BeforeEach (726-728)
  • AfterEach (754-756)
  • It (573-575)
vendor/github.com/onsi/gomega/gomega_dsl.go (2)
  • Expect (220-223)
  • Eventually (393-396)
vendor/github.com/onsi/ginkgo/v2/reporting_dsl.go (1)
  • CurrentSpecReport (33-35)
test/e2e/start_test.go (1)
vendor/github.com/onsi/ginkgo/v2/core_dsl.go (1)
  • Describe (514-516)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test (windows-latest)
  • GitHub Check: lint
  • GitHub Check: test (macos-13)
  • GitHub Check: e2e (ubuntu-24.04)
  • GitHub Check: test (ubuntu-22.04)
🔇 Additional comments (5)
Makefile (1)

34-34: LGTM! Platform-specific test filtering implemented correctly.

The addition of --ginkgo.label-filter=$(DEFAULT_GOOS) enables platform-specific test execution, which aligns with the new label annotations being added across the test suite.

test/e2e/setup_test.go (1)

59-59: LGTM! Platform labels added appropriately.

The addition of "linux" and "darwin" labels enables these init tests to be selected by the platform-specific label filter introduced in the Makefile.

test/e2e/start_test.go (1)

9-9: LGTM! Cross-platform labels added correctly.

The test validates error handling for a non-existing VM, which is platform-independent. Including all three platform labels ("windows", "linux", "darwin") ensures this test runs on all supported platforms.

test/e2e/macProvider_test.go (2)

25-55: LGTM! Cleanup logic is thorough.

The AfterEach properly handles both default and named VM cleanup scenarios with the correct provider flags.


149-158: Verify the extended timeout for libkrun.

The Eventually timeout is set to 20 minutes, while the equivalent test in setup_test.go (line 202) uses 10 minutes. If libkrun has longer cloud-init completion times on macOS, this is appropriate. Otherwise, consider aligning with the existing timeout.

@lilyLuLiu lilyLuLiu self-assigned this Nov 12, 2025
@lilyLuLiu lilyLuLiu moved this to Work In Progress in Project planning: crc Nov 12, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/e2e/vm_test.go (1)

42-42: LGTM! Platform labels correctly added.

The addition of platform labels Label("linux","darwin") correctly enables this test to run on both Linux and macOS, aligning with the PR's objective to add darwin libkrun test support. The syntax is correct for Ginkgo v2, and the test logic is platform-agnostic.

Optional: Consider adding spaces after commas for consistency: Label("linux", "darwin").

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d95343 and 3c97a91.

📒 Files selected for processing (5)
  • Makefile (1 hunks)
  • test/e2e/macProvider_test.go (1 hunks)
  • test/e2e/setup_test.go (1 hunks)
  • test/e2e/start_test.go (1 hunks)
  • test/e2e/vm_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • Makefile
  • test/e2e/macProvider_test.go
  • test/e2e/start_test.go
  • test/e2e/setup_test.go
🧰 Additional context used
🧬 Code graph analysis (1)
test/e2e/vm_test.go (1)
vendor/github.com/onsi/ginkgo/v2/core_dsl.go (1)
  • It (573-575)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test (windows-latest)
  • GitHub Check: lint
  • GitHub Check: e2e (ubuntu-24.04)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Work In Progress

Development

Successfully merging this pull request may close these issues.

1 participant