diff --git a/internal/ios/ios.go b/internal/ios/ios.go index fefcb97..c195b20 100644 --- a/internal/ios/ios.go +++ b/internal/ios/ios.go @@ -55,15 +55,12 @@ func EnsureSimulator(ctx context.Context, deviceName string, stdout io.Writer) e } // BootedUDID returns the UDID of the currently booted iOS simulator, or "" if none is booted. -func BootedUDID(ctx context.Context) (string, error) { - d, err := bootedSimulator(ctx) - if err != nil { - return "", err - } +func BootedUDID(ctx context.Context) string { + d, _ := bootedSimulator(ctx) if d == nil { - return "", nil + return "" } - return d.UDID, nil + return d.UDID } func bootedSimulator(ctx context.Context) (*simDevice, error) { diff --git a/internal/ios/ios_test.go b/internal/ios/ios_test.go index cd29f49..d957fe6 100644 --- a/internal/ios/ios_test.go +++ b/internal/ios/ios_test.go @@ -82,10 +82,7 @@ func TestPickSimulator_EmptyList(t *testing.T) { func TestBootedUDID_CanceledContext(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() - udid, err := BootedUDID(ctx) - if err == nil { - t.Error("expected error for canceled context, got nil") - } + udid := BootedUDID(ctx) if udid != "" { t.Errorf("expected empty UDID on canceled context, got %q", udid) } diff --git a/internal/testrun/driver.go b/internal/testrun/driver.go index a0d8539..be3a215 100644 --- a/internal/testrun/driver.go +++ b/internal/testrun/driver.go @@ -41,11 +41,7 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver "--platform", options.Platform, } if options.Platform == "ios" { - udid, err := ios.BootedUDID(ctx) - if err != nil { - return nil, nil, fmt.Errorf("find booted simulator: %w", err) - } - if udid != "" { + if udid := ios.BootedUDID(ctx); udid != "" { sidecarArgs = append(sidecarArgs, "--udid", udid) } } diff --git a/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt b/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt index 7cd5741..be6147e 100644 --- a/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt +++ b/sidecar/src/main/kotlin/dev/sanderling/sidecar/DriverBackend.kt @@ -568,7 +568,7 @@ class IosDriverBackend(private val udid: String) : DriverBackend { driver.waitForAppToSettle(null, null, durationMillis.toInt()) } - override fun healthy() = true + override fun healthy() = runCatching { driver.contentDescriptor(false); true }.getOrElse { false } override fun metrics(bundleId: String) = MetricsSample(0.0, 0L, 0L) }