Skip to content

Commit 2e3bd1d

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 6225 b: refs/heads/tswast-patch-1 c: 25bde60 h: refs/heads/master i: 6223: 1cd3d6f
1 parent 1885e91 commit 2e3bd1d

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 3751460021aeba8a2043b709773c9436340a6947
60+
refs/heads/tswast-patch-1: 25bde6027f987b68eae07b1be4b02a604d5f4a97
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/TESTING.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,32 @@ You can test against a remote datastore emulator as well. To do this, set the `
3838
Datastore localDatastore = DatastoreFactory.instance().get(options);
3939
```
4040

41-
Note that the remote datastore must be running before your tests are run. Also note that the `host` argument must start with "http://" or "https://".
41+
Note that the remote datastore must be running before your tests are run. Also note that the `host` argument must start with "http://" or "https://" if you are testing with a remote machine.
4242

4343

4444
### Testing interactions with Storage
4545

4646
There currently isn't an emulator for Google Cloud Storage, so an alternative is to create a test project. `RemoteGcsHelper` contains convenience methods to make setting up and cleaning up the test project easier. To use this class, follow the steps below:
4747

48-
1. Create a test Google App Engine project.
48+
1. Create a test Google Cloud project.
4949

50-
2. Create and download a JSON key by going to the Google Developer's Console and clicking API's & Auth > Credentials > Add Credentials > Service Credentials. Choose "JSON", download the file, and note its location.
50+
2. Create and download a JSON service account credentials file from the Google Developer's Console. See more about this on the [Google Cloud Platform Storage Authentication page][cloud-platform-storage-authentication].
5151

52-
3. Set environment variables `GCLOUD_TESTS_PROJECT_ID` and `GCLOUD_TESTS_KEY_PATH` according to your test project's ID and the location of the newly-downloaded JSON key file.
52+
3. Set environment variables `GCLOUD_TESTS_PROJECT_ID` and `GCLOUD_TESTS_KEY` according to your test project's ID and the location of the newly-downloaded JSON key file. On linux and mac, for example,
53+
```
54+
export GCLOUD_TESTS_PROJECT_ID=<project id>
55+
export GCLOUD_TESTS_KEY=/path/to/JSON/key.json
56+
```
5357

5458
4. Create and and use a `RemoteGcsHelper` object.
55-
Here is an example that uses the RemoteGcsHelper to create a bucket and clear the bucket at the end of the test.
59+
Here is an example that uses the `RemoteGcsHelper` to create a bucket and clear the bucket at the end of the test.
5660
```java
5761
RemoteGcsHelper gcsHelper = RemoteGcsHelper.create();
5862
Storage storage = StorageFactory.instance().get(gcsHelper.options());
5963
String bucket = RemoteGcsHelper.generateBucketName();
6064
storage.create(BucketInfo.of(bucket));
6165
// Do tests using Storage
62-
RemoteGcsHelper.deleteBucketRecursively(storage, bucket, 5, TimeUnit.SECONDS);
66+
RemoteGcsHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
6367
```
68+
69+
[cloud-platform-storage-authentication]:https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts

0 commit comments

Comments
 (0)