@@ -163,22 +163,29 @@ func (r *qemuInstanceResolver) ResolveInstance(ctx context.Context, nameOrID str
163163 return nameOrID , nameOrID , nil
164164}
165165
166- // TestQEMUBasicEndToEnd tests the complete instance lifecycle with QEMU.
167- // This is the primary integration test for QEMU support.
168- // It tests: create, get, list, logs, network, ingress, volumes, exec, and delete.
169- // It does NOT test: snapshot/standby, hot memory resize (not supported by QEMU in first pass).
170- func TestQEMUBasicEndToEnd (t * testing.T ) {
171- t .Parallel ()
172- // Require KVM access
166+ func requireQEMUUsable (t * testing.T ) {
167+ t .Helper ()
168+
173169 if _ , err := os .Stat ("/dev/kvm" ); os .IsNotExist (err ) {
174170 t .Skip ("/dev/kvm not available, skipping on this platform" )
175171 }
176172
177- // Require QEMU to be installed
178173 starter := qemu .NewStarter ()
179174 if _ , err := starter .GetBinaryPath (nil , "" ); err != nil {
180- t .Fatalf ("QEMU not available: %v" , err )
175+ t .Skipf ("QEMU not available: %v" , err )
176+ }
177+ if _ , err := starter .GetVersion (nil ); err != nil {
178+ t .Skipf ("QEMU is installed but not usable: %v" , err )
181179 }
180+ }
181+
182+ // TestQEMUBasicEndToEnd tests the complete instance lifecycle with QEMU.
183+ // This is the primary integration test for QEMU support.
184+ // It tests: create, get, list, logs, network, ingress, volumes, exec, and delete.
185+ // It does NOT test: snapshot/standby, hot memory resize (not supported by QEMU in first pass).
186+ func TestQEMUBasicEndToEnd (t * testing.T ) {
187+ t .Parallel ()
188+ requireQEMUUsable (t )
182189
183190 manager , tmpDir := setupTestManagerForQEMU (t )
184191 ctx := context .Background ()
@@ -575,12 +582,7 @@ func TestQEMUEntrypointEnvVars(t *testing.T) {
575582 if os .Getuid () != 0 {
576583 t .Skip ("Skipping test that requires root" )
577584 }
578-
579- // Require QEMU to be installed
580- starter := qemu .NewStarter ()
581- if _ , err := starter .GetBinaryPath (nil , "" ); err != nil {
582- t .Fatalf ("QEMU not available: %v" , err )
583- }
585+ requireQEMUUsable (t )
584586
585587 mgr , tmpDir := setupTestManagerForQEMU (t )
586588 ctx := context .Background ()
@@ -749,16 +751,7 @@ func TestQEMUEntrypointEnvVars(t *testing.T) {
749751// This tests QEMU's migrate-to-file snapshot mechanism.
750752func TestQEMUStandbyAndRestore (t * testing.T ) {
751753 t .Parallel ()
752- // Require KVM access
753- if _ , err := os .Stat ("/dev/kvm" ); os .IsNotExist (err ) {
754- t .Skip ("/dev/kvm not available, skipping on this platform" )
755- }
756-
757- // Require QEMU to be installed
758- starter := qemu .NewStarter ()
759- if _ , err := starter .GetBinaryPath (nil , "" ); err != nil {
760- t .Fatalf ("QEMU not available: %v" , err )
761- }
754+ requireQEMUUsable (t )
762755
763756 manager , tmpDir := setupTestManagerForQEMU (t )
764757 ctx := context .Background ()
@@ -870,14 +863,7 @@ func TestQEMUStandbyAndRestore(t *testing.T) {
870863
871864func TestQEMUForkFromRunningNetwork (t * testing.T ) {
872865 t .Parallel ()
873- if _ , err := os .Stat ("/dev/kvm" ); os .IsNotExist (err ) {
874- t .Skip ("/dev/kvm not available, skipping on this platform" )
875- }
876-
877- starter := qemu .NewStarter ()
878- if _ , err := starter .GetBinaryPath (nil , "" ); err != nil {
879- t .Fatalf ("QEMU not available: %v" , err )
880- }
866+ requireQEMUUsable (t )
881867
882868 manager , tmpDir := setupTestManagerForQEMU (t )
883869 ctx := context .Background ()
@@ -960,14 +946,7 @@ func TestQEMUForkFromRunningNetwork(t *testing.T) {
960946
961947func TestQEMUSnapshotFeature (t * testing.T ) {
962948 t .Parallel ()
963- if _ , err := os .Stat ("/dev/kvm" ); os .IsNotExist (err ) {
964- t .Skip ("/dev/kvm not available, skipping on this platform" )
965- }
966-
967- starter := qemu .NewStarter ()
968- if _ , err := starter .GetBinaryPath (nil , "" ); err != nil {
969- t .Skipf ("QEMU not available: %v" , err )
970- }
949+ requireQEMUUsable (t )
971950
972951 mgr , tmpDir := setupTestManagerForQEMU (t )
973952 runStandbySnapshotScenario (t , mgr , tmpDir , snapshotScenarioConfig {
0 commit comments