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 gcloud.test.common_e2e; | 5 library gcloud.test.common_e2e; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 import 'package:googleapis_auth/auth_io.dart' as auth; | 11 import 'package:googleapis_auth/auth_io.dart' as auth; |
12 import 'package:http/http.dart' as http; | 12 import 'package:http/http.dart' as http; |
13 | 13 |
14 import 'common.dart'; | 14 import 'common.dart'; |
15 | 15 |
16 const PROJECT = 'test-project'; | 16 const PROJECT = 'test-project'; |
17 | 17 |
18 // Enviroment variables for specifying the cloud project to use and the | 18 // Enviroment variables for specifying the cloud project to use and the |
19 // location of the service account key for that project. | 19 // location of the service account key for that project. |
20 const String PROJECT_ENV = 'GCLOUD_E2E_TEST_PROJECT'; | 20 const String PROJECT_ENV = 'GCLOUD_E2E_TEST_PROJECT'; |
21 const String SERVICE_KEY_LOCATION_ENV = 'GCLOUD_E2E_TEST_KEY'; | 21 const String SERVICE_KEY_LOCATION_ENV = 'GCLOUD_E2E_TEST_KEY'; |
22 | 22 |
23 // Default project and service key location used when running on the package | 23 // Default project and service key location used when running on the package |
24 // bot. | 24 // bot. |
25 const String DEFAULT_PROJECT = 'dart-gcloud-e2e'; | 25 const String DEFAULT_PROJECT = 'dart-gcloud-e2e'; |
26 const String DEFAULT_KEY_LOCATION = | 26 const String DEFAULT_KEY_LOCATION = |
27 'gs://dart-archive-internal/keys/dart-gcloud-e2e.json'; | 27 'gs://dart-archive-internal/keys/dart-gcloud-e2e.json'; |
28 | 28 |
29 // Used for db/datastore e2e tests: | |
30 // | |
31 // Non-ancestor queries (i.e. queries not lookups) result in index scans. | |
32 // The index tables are updated in a "eventually consistent" way. | |
33 // | |
34 // So this can make tests flaky, if the index updates take longer than the | |
35 // following constant. | |
36 const INDEX_UPDATE_DELAY = const Duration(seconds: 20); | |
37 | |
38 // Used for storage e2e tests: | |
39 // | |
40 // List operations on buckets are eventually consistent. Bucket deletion is | |
41 // also dependent on list operations to ensure the bucket is empty before | |
42 // deletion. | |
43 // | |
44 // So this can make tests flakky. The following delay is introduced as an | |
Søren Gjesse
2014/11/03 14:06:48
flakky -> flaky
kustermann
2014/11/03 14:07:48
Done.
| |
45 // attempt to account for that. | |
46 const STORAGE_LIST_DELAY = const Duration(seconds: 5); | |
47 | |
48 | |
29 bool onBot() { | 49 bool onBot() { |
30 // When running on the package-bot the current user is chrome-bot. | 50 // When running on the package-bot the current user is chrome-bot. |
31 var envName; | 51 var envName; |
32 if (Platform.isWindows) { | 52 if (Platform.isWindows) { |
33 envName = 'USERNAME'; | 53 envName = 'USERNAME'; |
34 } else { | 54 } else { |
35 envName = 'USER'; | 55 envName = 'USER'; |
36 } | 56 } |
37 return Platform.environment[envName] == 'chrome-bot'; | 57 return Platform.environment[envName] == 'chrome-bot'; |
38 } | 58 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 | 120 |
101 Future get done => _completer.future; | 121 Future get done => _completer.future; |
102 | 122 |
103 onDone(success) { | 123 onDone(success) { |
104 new Future.sync(() { | 124 new Future.sync(() { |
105 super.onDone(success); | 125 super.onDone(success); |
106 }).then((_) => _completer.complete(_)) | 126 }).then((_) => _completer.complete(_)) |
107 .catchError((error, stack) => _completer.completeError(error, stack)); | 127 .catchError((error, stack) => _completer.completeError(error, stack)); |
108 } | 128 } |
109 } | 129 } |
OLD | NEW |