Make CertificateProvider side effect free in test (#2706)

Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/2706

Creating a CertificateProvider in test had the side effect of generating certificate files, which fails in windows CI. This change makes sure the files aren't generated in test. See https://github.com/facebook/flipper/runs/3366318523.

Since it is not possible to start the flipper server 'physically' without writing file (for the secure server), figured to remove the test entirely, since there is high impact but little risk captured by it; if the server doesn't start, *any* manual / exploratory test will fail.

Reviewed By: lblasa

Differential Revision: D30423173

fbshipit-source-id: e411cc61df04120a7132983e9f8d3d140e4ca048
This commit is contained in:
Michel Weststrate
2021-08-19 04:07:10 -07:00
committed by Facebook GitHub Bot
parent 648e281377
commit ebe5e7f9ff
2 changed files with 35 additions and 25 deletions

View File

@@ -35,6 +35,7 @@ import ServerAdapter, {
} from './ServerAdapter';
import {createBrowserServer, createServer} from './ServerFactory';
import {FlipperServer} from '../FlipperServer';
import {isTest} from '../../utils/isProduction';
type ClientInfo = {
connection: ClientConnection | null | undefined;
@@ -109,6 +110,9 @@ class ServerController extends EventEmitter implements ServerEventsListener {
* which point Flipper is accepting connections.
*/
init() {
if (isTest()) {
throw new Error('Spawing new server is not supported in test');
}
const {insecure, secure} = this.store.getState().application.serverPorts;
this.initialized = this.certificateProvider
.loadSecureServerConfig()