Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for requestPays in java-storage call flow #995

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

singhravidutt
Copy link
Contributor

No description provided.

@singhravidutt
Copy link
Contributor Author

/gcbrun

@singhravidutt singhravidutt changed the title Requester pays Support for requestPays in java-storage call flow May 3, 2023
@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +5.65 🎉

Comparison is base (998eb64) 76.73% compared to head (6e18a67) 82.39%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #995      +/-   ##
============================================
+ Coverage     76.73%   82.39%   +5.65%     
- Complexity     1640     1782     +142     
============================================
  Files           101      101              
  Lines          7935     7946      +11     
  Branches        990      992       +2     
============================================
+ Hits           6089     6547     +458     
+ Misses         1409     1002     -407     
+ Partials        437      397      -40     
Flag Coverage Δ
integrationtest 67.40% <73.91%> (?)
unittest 76.75% <95.65%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...gle/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java 87.16% <ø> (+16.31%) ⬆️
...oud/hadoop/gcsio/GoogleCloudStorageClientImpl.java 95.45% <100.00%> (+24.48%) ⬆️
...oop/gcsio/GoogleCloudStorageClientReadChannel.java 84.10% <100.00%> (+5.36%) ⬆️
...op/gcsio/GoogleCloudStorageClientWriteChannel.java 94.38% <100.00%> (+3.68%) ⬆️

... and 24 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@singhravidutt singhravidutt marked this pull request as ready for review May 3, 2023 11:55
@@ -51,7 +51,7 @@
@VisibleForTesting
public class GoogleCloudStorageClientImpl extends ForwardingGoogleCloudStorage {
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();

private static GoogleCloudStorageImpl delegate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this final?

@@ -51,7 +51,7 @@
@VisibleForTesting
public class GoogleCloudStorageClientImpl extends ForwardingGoogleCloudStorage {
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();

private static GoogleCloudStorageImpl delegate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this static?

@@ -51,7 +51,7 @@
@VisibleForTesting
public class GoogleCloudStorageClientImpl extends ForwardingGoogleCloudStorage {
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();

private static GoogleCloudStorageImpl delegate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the base class and derived class having same field is an anti pattern

@@ -160,6 +168,11 @@ public void close() {
}
}

@Override
public GoogleCloudStorageImpl getDelegate() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is overriding the same method as base class?


public GoogleCloudStorageClientWriteChannel(
Storage storage,
GoogleCloudStorageOptions storageOptions,
StorageResourceId resourceId,
CreateObjectOptions createOptions,
boolean requesterPays,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wont this break the public API? Maybe add a new constructor?


public GoogleCloudStorageClientWriteChannel(
Storage storage,
GoogleCloudStorageOptions storageOptions,
StorageResourceId resourceId,
CreateObjectOptions createOptions,
boolean requesterPays,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider renaming this to something like requesterPaysEnabled or something similar

readChannel = getJavaStorageChannel(DEFAULT_ITEM_INFO, DEFAULT_READ_OPTION);
}

@Test
public void verifyRequesterPaysOption() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any integration test for requesterPays?

fakeReadChannel = spy(new FakeReadChannel(CONTENT));
when(mockedStorage.reader(blobIdCaptor.capture(), blobSourceOptionCaptor.capture()))
.thenReturn(fakeReadChannel);
readChannel =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are we really testing here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants