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 db_test; | 5 library db_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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 import 'dart:async'; | 47 import 'dart:async'; |
48 | 48 |
49 import 'package:unittest/unittest.dart'; | 49 import 'package:unittest/unittest.dart'; |
50 import 'package:gcloud/db.dart' as db; | 50 import 'package:gcloud/db.dart' as db; |
51 import 'package:gcloud/src/datastore_impl.dart' as datastore_impl; | 51 import 'package:gcloud/src/datastore_impl.dart' as datastore_impl; |
52 | 52 |
53 import '../../datastore/e2e/datastore_test_impl.dart' as datastore_test; | 53 import '../../datastore/e2e/datastore_test_impl.dart' as datastore_test; |
54 import '../../common_e2e.dart'; | 54 import '../../common_e2e.dart'; |
55 | 55 |
56 // Note: | |
57 // Non-ancestor queries (i.e. queries not lookups) result in index scans. | |
58 // The index tables are updated in a "eventually consistent" way. | |
59 // | |
60 // So this can make tests flaky, if the index updates take longer than the | |
61 // following constant. | |
62 const INDEX_UPDATE_DELAY = const Duration(seconds: 10); | |
63 | |
64 @db.Kind() | 56 @db.Kind() |
65 class Person extends db.Model { | 57 class Person extends db.Model { |
66 @db.StringProperty() | 58 @db.StringProperty() |
67 String name; | 59 String name; |
68 | 60 |
69 @db.IntProperty() | 61 @db.IntProperty() |
70 int age; | 62 int age; |
71 | 63 |
72 @db.ModelKeyProperty() | 64 @db.ModelKeyProperty() |
73 db.Key wife; | 65 db.Key wife; |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 main() { | 609 main() { |
618 var scopes = datastore_impl.DatastoreImpl.SCOPES; | 610 var scopes = datastore_impl.DatastoreImpl.SCOPES; |
619 | 611 |
620 withAuthClient(scopes, (String project, httpClient) { | 612 withAuthClient(scopes, (String project, httpClient) { |
621 var datastore = new datastore_impl.DatastoreImpl(httpClient, 's~$project'); | 613 var datastore = new datastore_impl.DatastoreImpl(httpClient, 's~$project'); |
622 return datastore_test.cleanupDB(datastore).then((_) { | 614 return datastore_test.cleanupDB(datastore).then((_) { |
623 return runE2EUnittest(() => runTests(new db.DatastoreDB(datastore))); | 615 return runE2EUnittest(() => runTests(new db.DatastoreDB(datastore))); |
624 }); | 616 }); |
625 }); | 617 }); |
626 } | 618 } |
OLD | NEW |