Skip to content

Commit cb4ccc5

Browse files
committed
Check which tests are fragile / depend on timing.
1 parent 7fee710 commit cb4ccc5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/fake_gcloud/lib/mem_datastore.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ class MemDatastore implements Datastore {
1717

1818
@override
1919
Future<List<Key>> allocateIds(List<Key> keys) async {
20+
await Future.delayed(Duration(milliseconds: 10));
2021
throw UnimplementedError(
2122
'fake_gcloud.Datastore.allocateIds is not implemented.',
2223
);
2324
}
2425

2526
@override
2627
Future<Transaction> beginTransaction({bool crossEntityGroup = false}) async {
28+
await Future.delayed(Duration(milliseconds: 10));
2729
return _Transaction();
2830
}
2931

@@ -34,6 +36,7 @@ class MemDatastore implements Datastore {
3436
List<Key> deletes = const [],
3537
Transaction? transaction,
3638
}) async {
39+
await Future.delayed(Duration(milliseconds: 10));
3740
if (autoIdInserts.isNotEmpty) {
3841
throw UnimplementedError(
3942
'fake_gcloud.Datastore.autoIdInserts is not implemented.',
@@ -147,6 +150,7 @@ class MemDatastore implements Datastore {
147150
List<Key> keys, {
148151
Transaction? transaction,
149152
}) async {
153+
await Future.delayed(Duration(milliseconds: 10));
150154
if (keys.any((k) => k.elements.any((e) => e.id == null))) {
151155
throw ArgumentError('Key contains null.');
152156
}
@@ -196,6 +200,7 @@ class MemDatastore implements Datastore {
196200
Partition partition = Partition.DEFAULT,
197201
Transaction? transaction,
198202
}) async {
203+
await Future.delayed(Duration(milliseconds: 10));
199204
List<Entity> items = _entities.values
200205
.where((e) => e.key.elements.last.kind == query.kind)
201206
.where((e) {
@@ -278,6 +283,7 @@ class MemDatastore implements Datastore {
278283

279284
@override
280285
Future<void> rollback(Transaction transaction) async {
286+
await Future.delayed(Duration(milliseconds: 10));
281287
return null;
282288
}
283289

@@ -413,6 +419,7 @@ class _Page implements Page<Entity> {
413419

414420
@override
415421
Future<Page<Entity>> next({int? pageSize}) async {
422+
await Future.delayed(Duration(milliseconds: 10));
416423
return _Page(_items, _offset + _pageSize, pageSize ?? _pageSize);
417424
}
418425
}

0 commit comments

Comments
 (0)