test: fix flaky testBucketPolicyV1RequesterPays it test#379
test: fix flaky testBucketPolicyV1RequesterPays it test#379frankyn merged 3 commits intogoogleapis:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #379 +/- ##
=========================================
Coverage 63.13% 63.13%
Complexity 601 601
=========================================
Files 32 32
Lines 5078 5078
Branches 481 481
=========================================
Hits 3206 3206
Misses 1708 1708
Partials 164 164 Continue to review full report at Codecov.
|
| storage.get( | ||
| bucketName, Storage.BucketGetOption.fields(BucketField.ID, BucketField.BILLING)); | ||
| assertNull(remoteBucket.requesterPays()); | ||
| remoteBucket = remoteBucket.toBuilder().setRequesterPays(true).build(); |
There was a problem hiding this comment.
Try not to reuse local variables for different objects as it's very error prone when code is updated.
| ImmutableList.of("storage.buckets.getIamPolicy", "storage.buckets.setIamPolicy"), | ||
| bucketOptions)); | ||
| remoteBucket = remoteBucket.toBuilder().setRequesterPays(false).build(); | ||
| updatedBucket = |
There was a problem hiding this comment.
Try not to reuse local variables as it's very error prone when code is updated.
| assertTrue(updatedBucket.requesterPays()); | ||
| assertNull(bucketDefault.requesterPays()); | ||
|
|
||
| Bucket bucketTrue = storage.update(bucketDefault.toBuilder().setRequesterPays(true).build()); |
There was a problem hiding this comment.
requesterPaysBucket? modifiedBucket?
There was a problem hiding this comment.
To me bucketDefault, bucketTrue, bucketFalse sound more informative than bucket, modifiedBucket, modifiedBucket2. But I'm okay with any names.
The test is updated to use a new bucket (and delete it at the end) instead of reusing the shared one.
Fixes #349