Skip to content

Commit fe9662d

Browse files
authored
docs: fix broken link for TESTING.md (#2126)
Fixes b/290932427
1 parent de80b66 commit fe9662d

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

TESTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Testing code that uses Google Cloud Storage
2+
3+
`RemoteStorageHelper` contains convenience methods to make setting up and cleaning up the test buckets easier. To use this class:
4+
5+
1. Create a test Google Cloud project.
6+
7+
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].
8+
9+
3. Create a `RemoteStorageHelper` object using your project ID and JSON key.
10+
Here is an example that uses the `RemoteStorageHelper` to create a bucket.
11+
```java
12+
RemoteStorageHelper helper =
13+
RemoteStorageHelper.create(PROJECT_ID, new FileInputStream("/path/to/my/JSON/key.json"));
14+
Storage storage = helper.getOptions().getService();
15+
String bucket = RemoteStorageHelper.generateBucketName();
16+
storage.create(BucketInfo.of(bucket));
17+
```
18+
19+
4. Run your tests.
20+
21+
5. Clean up the test project by using `forceDelete` to clear any buckets used.
22+
Here is an example that clears the bucket created in Step 3 with a timeout of 5 seconds.
23+
```java
24+
RemoteStorageHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
25+
```

google-cloud-storage/src/main/java/com/google/cloud/storage/testing/package-info.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
* RemoteStorageHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
3535
* }</pre>
3636
*
37-
* @see <a
38-
* href="https://github.com/googleapis/google-cloud-java/blob/master/TESTING.md#testing-code-that-uses-storage">
39-
* Google Cloud Java tools for testing</a>
37+
* @see <a href="https://github.com/googleapis/java-storage/blob/main/TESTING.md">Google Cloud
38+
* Storage testing</a>
4039
*/
4140
package com.google.cloud.storage.testing;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy