mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
fix(testrun): seam preflight so iOS routing tests pass on CI without xcrun
This commit is contained in:
1 parent
71019843ff
commit
b214df4b9d
2 files changed
+16
-1
No files matched your search
@@ -69,6 +69,10 @@ func resolveIOSTarget(ctx context.Context, options Options, stdout io.Writer) (O
|
||||
return options, nil
|
||||
}
|
||||
|
||||
// preflight is a seam so routing tests exercise driver construction without the
|
||||
// host-readiness checks (xcrun, java) that are absent on a Linux CI runner.
|
||||
var preflight = Preflight
|
||||
|
||||
// newDeviceDriver constructs the physical-device iOS driver and its cleanup. A
|
||||
// seam so routing tests assert the resolved identifiers reach DeviceOptions
|
||||
// without building or spawning a real runner.
|
||||
@@ -86,7 +90,7 @@ var newDeviceDriver = func(ctx context.Context, options ioscompanion.DeviceOptio
|
||||
// is driven runner-only over a usbmux tunnel. Android uses the JVM sidecar,
|
||||
// which is extracted, spawned, and dialed.
|
||||
func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver.DeviceDriver, func(), error) {
|
||||
if err := Preflight(ctx, options.Platform); err != nil {
|
||||
if err := preflight(ctx, options.Platform); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if options.Platform == "web" {
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
type stubDeviceDriver struct{ driver.DeviceDriver }
|
||||
|
||||
func TestBuildDriverRoutesPhysicalIOSToDeviceDriver(t *testing.T) {
|
||||
stubPreflight(t)
|
||||
original := newDeviceDriver
|
||||
t.Cleanup(func() { newDeviceDriver = original })
|
||||
|
||||
@@ -51,6 +52,7 @@ func TestBuildDriverRoutesPhysicalIOSToDeviceDriver(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBuildDriverSurfacesDeviceConstructionError(t *testing.T) {
|
||||
stubPreflight(t)
|
||||
original := newDeviceDriver
|
||||
t.Cleanup(func() { newDeviceDriver = original })
|
||||
newDeviceDriver = func(context.Context, ioscompanion.DeviceOptions) (driver.DeviceDriver, func(), error) {
|
||||
@@ -63,6 +65,15 @@ func TestBuildDriverSurfacesDeviceConstructionError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// stubPreflight bypasses the host-readiness checks so routing tests exercise
|
||||
// driver construction on a Linux CI runner that lacks xcrun/java.
|
||||
func stubPreflight(t *testing.T) {
|
||||
t.Helper()
|
||||
original := preflight
|
||||
t.Cleanup(func() { preflight = original })
|
||||
preflight = func(context.Context, string) error { return nil }
|
||||
}
|
||||
|
||||
func swapIOSResolveSeams(t *testing.T) {
|
||||
t.Helper()
|
||||
origTarget, origDevice, origEnsure := iosResolveTarget, iosResolveDevice, iosEnsureSimulator
|
||||
|
||||
Reference in new issue
Block a user