OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library datastore_test; | 5 library datastore_test; |
6 | 6 |
7 /// NOTE: In order to run these tests, the following datastore indices must | 7 /// NOTE: In order to run these tests, the following datastore indices must |
8 /// exist: | 8 /// exist: |
9 /// $ cat index.yaml | 9 /// $ cat index.yaml |
10 /// indexes: | 10 /// indexes: |
(...skipping 21 matching lines...) Expand all Loading... |
32 import 'package:gcloud/datastore.dart'; | 32 import 'package:gcloud/datastore.dart'; |
33 import 'package:gcloud/src/datastore_impl.dart' as datastore_impl; | 33 import 'package:gcloud/src/datastore_impl.dart' as datastore_impl; |
34 import 'package:gcloud/common.dart'; | 34 import 'package:gcloud/common.dart'; |
35 import 'package:unittest/unittest.dart'; | 35 import 'package:unittest/unittest.dart'; |
36 | 36 |
37 import '../error_matchers.dart'; | 37 import '../error_matchers.dart'; |
38 import 'utils.dart'; | 38 import 'utils.dart'; |
39 | 39 |
40 import '../../common_e2e.dart'; | 40 import '../../common_e2e.dart'; |
41 | 41 |
42 // Note: | |
43 // Non-ancestor queries (i.e. queries not lookups) result in index scans. | |
44 // The index tables are updated in a "eventually consistent" way. | |
45 // | |
46 // So this can make tests flaky, the index updates take longer than the | |
47 // following constant. | |
48 const INDEX_UPDATE_DELAY = const Duration(seconds: 10); | |
49 | |
50 Future sleep(Duration duration) { | 42 Future sleep(Duration duration) { |
51 var completer = new Completer(); | 43 var completer = new Completer(); |
52 new Timer(duration, completer.complete); | 44 new Timer(duration, completer.complete); |
53 return completer.future; | 45 return completer.future; |
54 } | 46 } |
55 | 47 |
56 Future<List<Entity>> consumePages(FirstPageProvider provider) { | 48 Future<List<Entity>> consumePages(FirstPageProvider provider) { |
57 return new StreamFromPages(provider).stream.toList(); | 49 return new StreamFromPages(provider).stream.toList(); |
58 } | 50 } |
59 | 51 |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 main() { | 1029 main() { |
1038 var scopes = datastore_impl.DatastoreImpl.SCOPES; | 1030 var scopes = datastore_impl.DatastoreImpl.SCOPES; |
1039 | 1031 |
1040 withAuthClient(scopes, (String project, httpClient) { | 1032 withAuthClient(scopes, (String project, httpClient) { |
1041 var datastore = new datastore_impl.DatastoreImpl(httpClient, 's~$project'); | 1033 var datastore = new datastore_impl.DatastoreImpl(httpClient, 's~$project'); |
1042 return cleanupDB(datastore).then((_) { | 1034 return cleanupDB(datastore).then((_) { |
1043 return runE2EUnittest(() => runTests(datastore)); | 1035 return runE2EUnittest(() => runTests(datastore)); |
1044 }); | 1036 }); |
1045 }); | 1037 }); |
1046 } | 1038 } |
OLD | NEW |