Skip to content

Commit df1f271

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 6229 b: refs/heads/tswast-patch-1 c: b52ded3 h: refs/heads/master i: 6227: faeec12
1 parent 22acf75 commit df1f271

2 files changed

Lines changed: 11 additions & 5 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: 396db25a169b285cced65274092ce35b95f95fbf
60+
refs/heads/tswast-patch-1: b52ded39f922ffbab63be18944d50a108185bbc5
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/TESTING.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ You can test against a remote datastore emulator as well. To do this, set the `
4040

4141
Note that the remote datastore must be running before your tests are run.
4242

43-
4443
### Testing code that uses Storage
4544

4645
Currently, there 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:
@@ -49,15 +48,22 @@ Currently, there isn't an emulator for Google Cloud Storage, so an alternative i
4948

5049
2. 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].
5150

52-
3. Create and use a `RemoteGcsHelper` object using your project ID and JSON key.
53-
Here is an example that uses the `RemoteGcsHelper` to create a bucket and clear the bucket at the end of the test.
51+
3. Create a `RemoteGcsHelper` object using your project ID and JSON key.
52+
Here is an example that uses the `RemoteGcsHelper` to create a bucket.
5453
```java
5554
RemoteGcsHelper gcsHelper = RemoteGcsHelper.create(PROJECT_ID, "/path/to/my/JSON/key.json");
5655
Storage storage = StorageFactory.instance().get(gcsHelper.options());
5756
String bucket = RemoteGcsHelper.generateBucketName();
5857
storage.create(BucketInfo.of(bucket));
59-
// Do tests using Storage
58+
```
59+
60+
4. Run your tests.
61+
62+
5. Clean up the test project by using `forceDelete` to clear any buckets used.
63+
Here is an example that clears the bucket created in Step 3 with a timeout of 5 seconds.
64+
```java
6065
RemoteGcsHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
6166
```
6267

68+
6369
[cloud-platform-storage-authentication]:https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts

0 commit comments

Comments
 (0)