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
This commit is contained in:
Michel Weststrate
2021-09-27 02:15:20 -07:00
committed by Facebook GitHub Bot
parent 987755bb09
commit b539f4d870
2 changed files with 18 additions and 5 deletions

View File

@@ -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
}
}

View File

@@ -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 {