Skip to content

feat(microvmtest): add untagged microVM test gate package - #503

Open
rigel-mintaka wants to merge 1 commit into
mainfrom
compass-runner/rig-2520-microvmtest-gate
Open

feat(microvmtest): add untagged microVM test gate package#503
rigel-mintaka wants to merge 1 commit into
mainfrom
compass-runner/rig-2520-microvmtest-gate

Conversation

@rigel-mintaka

Copy link
Copy Markdown
Contributor

Add go/internal/microvmtest, the shared runtime gate the two-tier tag rule requires. Require(t) probes whether /dev/kvm is openable by the current uid, skips with a named reason when it is not, and hard-fails when COMPASS_REQUIRE_MICROVM is set — the pgtest RequireDSN/COMPASS_REQUIRE_LIVE posture, so a KVM-less CI leg reds rather than silently passing.

The pure decideKVMSource decision function is split from the *testing.T dispatch (mirroring decideDSNSource) so the policy is unit-testable without real hardware; the /dev/kvm open probe is injected as a bool, kept out of the pure function.

Unlike pgtest, the package's non-test files compile UNTAGGED so the moon battery type-checks the gate everywhere. The //go:build microvm && unix tag lives in the consuming V2a+ integration tests, which call microvmtest.Require(t) first; this package is the untagged shared gate they import.

Refs RIG-2520

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Aug 22, 2026

Copy link
Copy Markdown

RIG-2520

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-runner-rig-2520-micr.compass-eng-docs.pages.dev

Deployed from compass-runner/rig-2520-microvmtest-gate at 3855996.

Add `go/internal/microvmtest`, the shared runtime gate the two-tier tag rule requires. `Require(t)` probes whether `/dev/kvm` is openable by the current uid, skips with a named reason when it is not, and hard-fails when `COMPASS_REQUIRE_MICROVM` is set — the pgtest `RequireDSN`/`COMPASS_REQUIRE_LIVE` posture, so a KVM-less CI leg reds rather than silently passing.

The pure `decideKVMSource` decision function is split from the `*testing.T` dispatch (mirroring `decideDSNSource`) so the policy is unit-testable without real hardware; the `/dev/kvm` open probe is injected as a bool, kept out of the pure function.

Unlike pgtest, the package's non-test files compile UNTAGGED so the moon battery type-checks the gate everywhere. The `//go:build microvm && unix` tag lives in the consuming V2a+ integration tests, which call `microvmtest.Require(t)` first; this package is the untagged shared gate they import.

Refs RIG-2520

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-runner/rig-2520-microvmtest-gate branch from 5c963d8 to 3855996 Compare August 23, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant