Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: tests/standalone/io/socket_bind_test.dart

Issue 2546733002: Attempt to reduce flakiness rate of io test (Closed)
Patch Set: add retrying of tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/socket_source_address_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_bind_test.dart
diff --git a/tests/standalone/io/socket_bind_test.dart b/tests/standalone/io/socket_bind_test.dart
index f701f0c806109cad0db7dfbdad65763f8baa8a3a..08963eb36bcc0f949c9d31e1fb57d1ac7377e1fb 100644
--- a/tests/standalone/io/socket_bind_test.dart
+++ b/tests/standalone/io/socket_bind_test.dart
@@ -4,11 +4,12 @@
import 'dart:async';
import 'dart:io';
-import 'dart:convert';
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
+import 'test_utils.dart' show freeIPv4AndIPv6Port, retry;
+
testBindShared(String host, bool v6Only) {
asyncStart();
ServerSocket.bind(
@@ -112,27 +113,6 @@ testListenCloseListenClose(String host) async {
asyncEnd();
}
-Future<int> freeIPv4AndIPv6Port() async {
- var socket =
- await ServerSocket.bind(InternetAddress.ANY_IP_V6, 0, v6Only: false);
- int port = socket.port;
- await socket.close();
- return port;
-}
-
-Future retry(Future fun(), {int maxCount: 10}) async {
- for (int i = 0; i < maxCount; i++) {
- try {
- // If there is no exception this will simply return, otherwise we keep
- // trying.
- return await fun();
- } catch (_) {}
- print("Failed to execute test closure in attempt $i "
- "(${maxCount - i} retries left).");
- }
- return await fun();
-}
-
main() async {
asyncStart();
« no previous file with comments | « no previous file | tests/standalone/io/socket_source_address_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698