From b539f4d870a43fb24a07111fea8b9b5a935c2001 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 27 Sep 2021 02:15:20 -0700 Subject: [PATCH] Fix startLogging / stopLogging for ArchivedDevice Summary: Unit test would fail on trying to emit server commands when creating a ArchivedDevice. But archived devices can silently ignore log start commands, which fixes the failing test as well. Example failing run: https://github.com/facebook/flipper/runs/3685776120 I'm not sure why the test wasn't _always_ failing Reviewed By: lblasa Differential Revision: D31142584 fbshipit-source-id: 57106ecdace9f72444eaf68ee9fa024c84556a1c --- desktop/app/src/devices/ArchivedDevice.tsx | 14 ++++++++++++++ .../app/src/utils/__tests__/exportData.node.tsx | 9 ++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/desktop/app/src/devices/ArchivedDevice.tsx b/desktop/app/src/devices/ArchivedDevice.tsx index d0c5ff5e6..366ee8b13 100644 --- a/desktop/app/src/devices/ArchivedDevice.tsx +++ b/desktop/app/src/devices/ArchivedDevice.tsx @@ -68,4 +68,18 @@ export default class ArchivedDevice extends BaseDevice { getArchivedScreenshotHandle(): string | null { return this.archivedScreenshotHandle; } + + /** + * @override + */ + async startLogging() { + // No-op + } + + /** + * @override + */ + async stopLogging() { + // No-op + } } diff --git a/desktop/app/src/utils/__tests__/exportData.node.tsx b/desktop/app/src/utils/__tests__/exportData.node.tsx index 3e8b558cc..e09ed7c76 100644 --- a/desktop/app/src/utils/__tests__/exportData.node.tsx +++ b/desktop/app/src/utils/__tests__/exportData.node.tsx @@ -31,6 +31,7 @@ import { PluginClient, DevicePluginClient, sleep, + Device, } from 'flipper-plugin'; import {selectPlugin} from '../../reducers/connections'; import {TestIdler} from '../Idler'; @@ -71,7 +72,7 @@ function generateNotifications( return {id, title, message, severity}; } -function generateClientIdentifier(device: TestDevice, app: string): string { +function generateClientIdentifier(device: Device, app: string): string { const {os, deviceType, serial} = device; const identifier = `${app}#${os}#${deviceType}#${serial}`; return identifier; @@ -97,10 +98,8 @@ function generateClientFromClientWithSalt( query: {app, os, device, device_id: salt + '-' + device_id}, }; } -function generateClientFromDevice( - device: TestDevice, - app: string, -): ClientExport { + +function generateClientFromDevice(device: Device, app: string): ClientExport { const {os, deviceType, serial} = device; const identifier = generateClientIdentifier(device, app); return {