[frdp] Add configurable timeouts for VM. (#22893)
This adds configurable timeouts for the Dart VM. Due to some testing machines running things quite slowly, this is becoming more necessary.
This commit is contained in:
@@ -22,8 +22,7 @@ void main() {
|
||||
mockRunner = MockSshCommandRunner();
|
||||
// Adds some extra junk to make sure the strings will be cleaned up.
|
||||
when(mockRunner.run(any)).thenAnswer((_) =>
|
||||
Future<List<String>>.value(
|
||||
<String>['123\n\n\n', '456 ', '789']));
|
||||
Future<List<String>>.value(<String>['123\n\n\n', '456 ', '789']));
|
||||
const String address = 'fe80::8eae:4cff:fef4:9247';
|
||||
const String interface = 'eno1';
|
||||
when(mockRunner.address).thenReturn(address);
|
||||
@@ -86,7 +85,10 @@ void main() {
|
||||
|
||||
mockPeerConnections = <MockPeer>[];
|
||||
uriConnections = <Uri>[];
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
return Future<json_rpc.Peer>(() async {
|
||||
final MockPeer mp = MockPeer();
|
||||
mockPeerConnections.add(mp);
|
||||
|
||||
@@ -17,7 +17,10 @@ void main() {
|
||||
});
|
||||
|
||||
test('null connector', () async {
|
||||
Future<json_rpc.Peer> mockServiceFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockServiceFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
return Future<json_rpc.Peer>(() => null);
|
||||
}
|
||||
|
||||
@@ -28,7 +31,10 @@ void main() {
|
||||
|
||||
test('disconnect closes peer', () async {
|
||||
final MockPeer peer = MockPeer();
|
||||
Future<json_rpc.Peer> mockServiceFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockServiceFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
return Future<json_rpc.Peer>(() => peer);
|
||||
}
|
||||
|
||||
@@ -84,7 +90,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(() => flutterViewCannedResponses));
|
||||
return Future<json_rpc.Peer>(() => mockPeer);
|
||||
@@ -139,7 +148,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(() => flutterViewCannedResponses));
|
||||
return Future<json_rpc.Peer>(() => mockPeer);
|
||||
@@ -186,7 +198,10 @@ void main() {
|
||||
]
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(
|
||||
() => flutterViewCannedResponseMissingId));
|
||||
@@ -239,7 +254,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer(
|
||||
(_) => Future<Map<String, dynamic>>(() => vmCannedResponse));
|
||||
return Future<json_rpc.Peer>(() => mockPeer);
|
||||
@@ -278,7 +296,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(
|
||||
() => flutterViewCannedResponseMissingIsolateName));
|
||||
@@ -311,7 +332,10 @@ void main() {
|
||||
|
||||
test('verify timeout fires', () async {
|
||||
const Duration timeoutTime = Duration(milliseconds: 100);
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
// Return a command that will never complete.
|
||||
when(mockPeer.sendRequest(any, any))
|
||||
.thenAnswer((_) => Completer<Map<String, dynamic>>().future);
|
||||
|
||||
Reference in New Issue
Block a user