Skip to content

add retry logic to try and make dtd_test less flaky #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkgs/dart_mcp_server/test/tools/dtd_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:dart_mcp_server/src/mixins/dtd.dart';
import 'package:dart_mcp_server/src/server.dart';
import 'package:dart_mcp_server/src/utils/analytics.dart';
import 'package:dart_mcp_server/src/utils/constants.dart';
import 'package:devtools_shared/devtools_shared.dart';
import 'package:test/test.dart';
import 'package:unified_analytics/testing.dart';
import 'package:unified_analytics/unified_analytics.dart' as ua;
Expand Down Expand Up @@ -196,7 +197,11 @@ void main() {
isFlutter: false,
);
await pumpEventQueue();
expect(server.activeVmServices.length, 1);
await runWithRetry(
callback: () => expect(server.activeVmServices.length, 1),
maxRetries: 5,
);

// TODO: It can cause an error in the mcp server if we haven't set
// up the listeners yet.
await Future<void>.delayed(const Duration(seconds: 1));
Expand Down