mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(ios): three unbacked reads report not-supported instead of success
RecentLogs returned an empty slice, Metrics a zeroed sample and Health a hardcoded Ready: true, which are the same values a working read returns. Every property over state.logs held vacuously on iOS with nothing saying the logs were never read. driver.ErrNotSupported makes the silence representable.
This commit is contained in:
1 parent
08df960e0f
commit
1de179995b
3 files changed
+56
-16
No files matched your search
@@ -699,14 +699,35 @@ func TestForegroundAppFallsBackToOtherRunningUserApp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestHealthReportsIOS(t *testing.T) {
|
||||
// The three reads the companion has no RPC for must say so. Answering an empty
|
||||
// log slice, a zeroed sample or Ready reports three checks as having passed
|
||||
// that never ran, and a spec's log properties then hold on evidence nobody
|
||||
// collected.
|
||||
func TestUnbackedReadsReportNotSupported(t *testing.T) {
|
||||
d := newTestDriver(&fakeCompanion{})
|
||||
health, err := d.Health(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("Health: %v", err)
|
||||
|
||||
logs, err := d.RecentLogs(context.Background(), time.Time{}, "E")
|
||||
if !errors.Is(err, driver.ErrNotSupported) {
|
||||
t.Errorf("RecentLogs err = %v, want driver.ErrNotSupported", err)
|
||||
}
|
||||
if !health.Ready || health.Platform != "ios" {
|
||||
t.Fatalf("Health = %+v, want ready ios", health)
|
||||
if len(logs) != 0 {
|
||||
t.Errorf("RecentLogs returned %d entries alongside its error", len(logs))
|
||||
}
|
||||
|
||||
metrics, err := d.Metrics(context.Background(), "com.fixture")
|
||||
if !errors.Is(err, driver.ErrNotSupported) {
|
||||
t.Errorf("Metrics err = %v, want driver.ErrNotSupported", err)
|
||||
}
|
||||
if metrics != (driver.Metrics{}) {
|
||||
t.Errorf("Metrics = %+v, want the zero sample", metrics)
|
||||
}
|
||||
|
||||
health, err := d.Health(context.Background())
|
||||
if !errors.Is(err, driver.ErrNotSupported) {
|
||||
t.Errorf("Health err = %v, want driver.ErrNotSupported", err)
|
||||
}
|
||||
if health.Ready {
|
||||
t.Errorf("Health = %+v: the driver reports a readiness check it never ran", health)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user