-
Notifications
You must be signed in to change notification settings - Fork 604
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
storage: introduce requesterPays #2392
storage: introduce requesterPays #2392
Conversation
eefabb9
to
2463780
Compare
Storage coverage is 100% - the drop is just from #2342. |
I've run into a problem when writing the system tests. A series of requests are outlined here:
"gcloud-node-whitelist-ci-tests" is User B's project ID, but not the name of the bucket we're trying to delete. I've tried granting |
@stephenplusplus I'll try to reproduce this error using the JSON API directly. I was able to get this workflow working using the Ruby client. I'll keep you posted! |
c66bb60
to
56032a0
Compare
All system tests are added, however I'm having trouble testing the download behavior of a file. The system tests are configured to use two accounts:
There is a problem when User B tries to download a file from User A. When User B provides the @frankyn any ideas? Thanks! |
56032a0
to
376e285
Compare
There are many code refactoring in this PR, which I'm not familiar with. @callmehiphop Can you help review this? |
The issue with downloading a file has been caught, and a solution is in the works. The premise of the problem: In What we need to do: buffer the stream for the response body, right before we return that error. I've done that, and it works! I just need some time to figure out if it's going to affect other parts of the library. But, at this time, we can safely mark the surface problems as resolved. |
This is ready for a review / merge / party to celebrate @frankyn. |
packages/storage/src/file.js
Outdated
bucketName: self.bucket.name, | ||
fileName: encodeURIComponent(self.name) | ||
}), | ||
uri: '', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great, I left a question and comment. Not a strict code review and only verifying documentation for the feature.
packages/storage/src/file.js
Outdated
bucketName: self.bucket.name, | ||
fileName: encodeURIComponent(self.name) | ||
}), | ||
uri: '', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/storage/src/bucket.js
Outdated
* </p> | ||
* </div> | ||
* | ||
* Enable `requesterPays` functionality for this bucket. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/storage/test/bucket.js
Outdated
describe('exists', function() { | ||
it('should call get', function(done) { | ||
bucket.get = function() { | ||
assert.strictEqual(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, not sure if it's still required.
Fixes #2371
To Dos
userProject
ingcs-resumable-upload
(done)Bucket Operations
storage.createBucket({ requesterPays: true })
bucket.create({ requesterPays: true })
bucket.disableRequesterPays()
bucket.enableRequesterPays()
bucket.combine(sourceFiles, destinationFile, { userProject: 'project-id' })
bucket.createChannel(id, config, { userProject: 'project-id' })
bucket.delete({ userProject: 'project-id' })
bucket.deleteFiles({ userProject: 'project-id' })
bucket.exists({ userProject: 'project-id' })
// callsbucket.getMetadata
bucket.get({ userProject: 'project-id' })
// callsbucket.getMetadata
bucket.getFiles({ userProject: 'project-id' })
bucket.getFilesStream({ userProject: 'project-id' })
bucket.getMetadata({ userProject: 'project-id' })
bucket.makePrivate({ userProject: 'project-id' })
// callsbucket.getFiles
andbucket.setMetadata
bucket.setMetadata({ userProject: 'project-id' })
bucket.upload('file.txt', { userProject: 'project-id' })
// callsfile.createWriteStream
File Operations
file.copy('newfile.txt', { userProject: 'project-id' })
file.createReadStream({ userProject: 'project-id' })
file.createResumableUpload({ userProject: 'project-id' })
file.createWriteStream({ userProject: 'project-id' })
file.delete({ userProject: 'project-id' })
file.download({ userProject: 'project-id' })
// callsfile.createReadStream
file.exists({ userProject: 'project-id' })
// callsfile.getMetadata
file.get({ userProject: 'project-id' })
// callsfile.getMetadata
file.getMetadata({ userProject: 'project-id' })
file.makePrivate({ userProject: 'project-id' })
// callsfile.setMetadata
file.move({ userProject: 'project-id' })
// callsfile.copy
file.save(data, { userProject: 'project-id' })
// callsfile.createWriteStream
file.setMetadata(metadata, { userProject: 'project-id' })
file.setStorageClass(storageClass, { userProject: 'project-id' })
// callsfile.copy