Skip to content

Commit 0fe2a31

Browse files
alexmarkovCommit Queue
authored and
Commit Queue
committed
[tests] Fix flaky standalone/io/http_auth_test
This is an attempt to fix flaky failure ``` Unhandled exception: Exception: Fatal: asyncStart() was called even though we are done with testing.. This is most likely a bug in your test. #0 asyncStart (package:expect/async_helper.dart:53) #1 asyncExpectThrows (package:expect/async_helper.dart:140) #2 testMalformedAuthenticateHeaderWithAuthHandler.<anonymous closure> (file:///C:/b/s/w/ir/tests/standalone/io/http_auth_test.dart:263) #3 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:951) #4 Future._propagateToListeners (dart:async/future_impl.dart:980) #5 Future._completeWithValue (dart:async/future_impl.dart:723) #6 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:807) #7 _microtaskLoop (dart:async/schedule_microtask.dart:42) #8 _startMicrotaskLoop (dart:async/schedule_microtask.dart:60) #9 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:127) #10 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:194) --- Re-run this test: python3 tools/test.py -n vm-aot-win-release-x64 standalone/io/http_auth_test ``` The test has multiple calls to asyncExpectThrows which uses asyncStart/asyncEnd, but only one top-level asyncStart/asyncEnd is allowed. In addition to a top-level asyncStart/asyncEnd, also add asyncStart/asyncEnd around creation and shutdown of the server in order to make sure all test cases are completed before test is finished. TEST=standalone/io/http_auth_test Change-Id: Ibb55dbae2c2e48e18f51f9a0adc24101d6121a8c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425600 Reviewed-by: Brian Quinlan <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 211209b commit 0fe2a31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/standalone/io/http_auth_test.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Server {
1414
bool passwordChanged = false;
1515

1616
Future<Server> start() {
17+
asyncStart();
1718
var completer = new Completer<Server>();
1819
HttpServer.bind("127.0.0.1", 0).then((s) {
1920
server = s;
@@ -79,7 +80,9 @@ class Server {
7980
}
8081

8182
void shutdown() {
82-
server.close();
83+
server.close().then((_) {
84+
asyncEnd();
85+
});
8386
}
8487

8588
int get port => server.port;
@@ -362,6 +365,8 @@ void testLocalServerDigest() {
362365
}
363366

364367
main() {
368+
asyncStart();
369+
365370
testUrlUserInfo();
366371
testBasicNoCredentials();
367372
testBasicCredentials();
@@ -374,4 +379,6 @@ main() {
374379
//testLocalServerBasic();
375380
//testLocalServerBearer();
376381
//testLocalServerDigest();
382+
383+
asyncEnd();
377384
}

0 commit comments

Comments
 (0)