Stop serving Observatory by default (#122419)
Observatory can still be enabled by providing `--serve-observatory` or invoking the `_serveObservatory` private service RPC via web socket or HTTP. Related to https://github.com/dart-lang/sdk/issues/50233
This commit is contained in:
@@ -153,10 +153,6 @@ const FakeVmServiceRequest evictShader = FakeVmServiceRequest(
|
||||
}
|
||||
);
|
||||
|
||||
const FakeVmServiceRequest serveObservatory = FakeVmServiceRequest(
|
||||
method: '_serveObservatory',
|
||||
);
|
||||
|
||||
final Uri testUri = Uri.parse('foo://bar');
|
||||
|
||||
void main() {
|
||||
@@ -196,7 +192,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can attach to device successfully', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
]);
|
||||
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
||||
@@ -220,7 +215,6 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
]);
|
||||
final FakeResidentCompiler residentCompiler = FakeResidentCompiler()
|
||||
@@ -312,7 +306,6 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
]);
|
||||
final FakeResidentCompiler residentCompiler = FakeResidentCompiler()
|
||||
@@ -337,7 +330,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can attach to device successfully with --fast-start', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -406,7 +398,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can handle an RPC exception from hot reload', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
]);
|
||||
@@ -440,7 +431,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner fails its operation if the device initialization is not complete', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
]);
|
||||
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
||||
@@ -462,7 +452,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can handle an reload-barred exception from hot reload', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
]);
|
||||
@@ -498,7 +487,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner reports hot reload event with null safety analytics', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
]);
|
||||
@@ -546,7 +534,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner does not reload sources if no sources changed', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -591,7 +578,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner reports error with missing entrypoint file', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -652,7 +638,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner resets compilation time on reload reject', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -717,7 +702,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can send target platform to analytics from hot reload', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -781,7 +765,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can perform fast reassemble', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
FakeVmServiceRequest(
|
||||
method: 'getVM',
|
||||
jsonResponse: fakeVM.toJson(),
|
||||
@@ -872,7 +855,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner reports hot reload time details', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
FakeVmServiceRequest(
|
||||
method: 'getVM',
|
||||
jsonResponse: fakeVM.toJson(),
|
||||
@@ -962,7 +944,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can send target platform to analytics from full restart', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -1023,7 +1004,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner can remove breakpoints and exception-pause-mode from paused isolate during hot restart', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -1097,7 +1077,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner will alternative the name of the dill file uploaded for a hot restart', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
@@ -1220,7 +1199,6 @@ void main() {
|
||||
testUsingContext('ResidentRunner Can handle an RPC exception from hot restart', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
]);
|
||||
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
||||
@@ -1653,7 +1631,6 @@ flutter:
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
listViews,
|
||||
serveObservatory,
|
||||
]);
|
||||
residentRunner = ColdRunner(
|
||||
<FlutterDevice>[
|
||||
@@ -1696,7 +1673,6 @@ flutter:
|
||||
testUsingContext('HotRunner writes vm service file when providing debugging option', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1719,7 +1695,6 @@ flutter:
|
||||
testUsingContext('HotRunner copies compiled app.dill to cache during startup', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1748,7 +1723,6 @@ flutter:
|
||||
testUsingContext('HotRunner copies compiled app.dill to cache during startup with dart defines', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1779,7 +1753,6 @@ flutter:
|
||||
testUsingContext('HotRunner copies compiled app.dill to cache during startup with null safety', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1810,7 +1783,6 @@ flutter:
|
||||
testUsingContext('HotRunner copies compiled app.dill to cache during startup with track-widget-creation', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1834,7 +1806,6 @@ flutter:
|
||||
testUsingContext('HotRunner does not copy app.dill if a dillOutputPath is given', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1858,7 +1829,6 @@ flutter:
|
||||
testUsingContext('HotRunner copies compiled app.dill to cache during startup with --track-widget-creation', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1886,7 +1856,6 @@ flutter:
|
||||
testUsingContext('HotRunner calls device dispose', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1907,7 +1876,6 @@ flutter:
|
||||
testUsingContext('HotRunner handles failure to write vmservice file', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
listViews,
|
||||
]);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
@@ -1932,7 +1900,6 @@ flutter:
|
||||
testUsingContext('ColdRunner writes vm service file when providing debugging option', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
serveObservatory,
|
||||
], wsAddress: testUri);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||
residentRunner = ColdRunner(
|
||||
|
||||
@@ -197,24 +197,22 @@ void main() {
|
||||
testWithoutContext('enables Observatory on run', () async {
|
||||
await flutterRun.run(
|
||||
withDebugger: true,
|
||||
// TODO(bkonyi): uncomment once Observatory is disabled by default
|
||||
// See https://github.com/dart-lang/sdk/issues/50233
|
||||
// serveObservatory: true,
|
||||
serveObservatory: true,
|
||||
);
|
||||
expect(await isObservatoryAvailable(), true);
|
||||
});
|
||||
|
||||
testWithoutContext('enables Observatory on attach', () async {
|
||||
await flutterRun.run(withDebugger: true, serveObservatory: false);
|
||||
await flutterRun.run(withDebugger: true);
|
||||
// Bail out if Observatory is still served by default in the VM.
|
||||
// TODO(bkonyi): replace this with the following once Observatory is disabled in the VM:
|
||||
// expect(await isObservatoryAvailable(), isFalse);
|
||||
if (await isObservatoryAvailable()) {
|
||||
return;
|
||||
}
|
||||
await flutterAttach.attach(
|
||||
flutterRun.vmServicePort!,
|
||||
// TODO(bkonyi): uncomment once Observatory is disabled by default
|
||||
// See https://github.com/dart-lang/sdk/issues/50233
|
||||
// serveObservatory: true,
|
||||
serveObservatory: true,
|
||||
);
|
||||
expect(await isObservatoryAvailable(), true);
|
||||
});
|
||||
|
||||
@@ -505,7 +505,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
|
||||
bool expressionEvaluation = true,
|
||||
bool structuredErrors = false,
|
||||
bool singleWidgetReloads = false,
|
||||
bool serveObservatory = true,
|
||||
bool serveObservatory = false,
|
||||
String? script,
|
||||
List<String>? additionalCommandArgs,
|
||||
}) async {
|
||||
@@ -545,7 +545,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
|
||||
bool startPaused = false,
|
||||
bool pauseOnExceptions = false,
|
||||
bool singleWidgetReloads = false,
|
||||
bool serveObservatory = true,
|
||||
bool serveObservatory = false,
|
||||
List<String>? additionalCommandArgs,
|
||||
}) async {
|
||||
_attachPort = port;
|
||||
|
||||
Reference in New Issue
Block a user