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

Cloud Storage with local emulator #18

Closed
lukesneeringer opened this issue Sep 21, 2017 · 4 comments
Closed

Cloud Storage with local emulator #18

lukesneeringer opened this issue Sep 21, 2017 · 4 comments
Assignees
Labels
api: storage Issues related to the googleapis/nodejs-storage API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@lukesneeringer
Copy link
Contributor

From @arbesfeld on October 20, 2016 19:50

There are a few "Mock s3" servers that run in memory/disk. Since the google cloud storage and S3 APIs are the same, I was wondering if there was a way to use one of these servers with the Cloud Storage client? If not, what is the recommended way to use this API for local development?

Copied from original issue: googleapis/google-cloud-node#1731

@lukesneeringer lukesneeringer added type: question Request for information or clarification. Not an issue. api: storage labels Sep 21, 2017
@lukesneeringer
Copy link
Contributor Author

From @stephenplusplus on October 20, 2016 19:52

Can you link the mock libraries? I'm not sure they'd be the same, but soon we will support using a custom endpoint which accepts the requests from our API (#1630).

@lukesneeringer
Copy link
Contributor Author

From @arbesfeld on October 20, 2016 19:54

Here are a few :

@lukesneeringer
Copy link
Contributor Author

From @nfarina on February 13, 2017 18:40

I found that it was simple enough to create my own mock classes to emulate Google Cloud Storage just enough for my tests to pass. I posted my code to this gist in case anyone finds it useful as a starting point. Note: written in ES7 with Flow annotations.

@stephenplusplus
Copy link
Contributor

I don't anticipate having an official solution for this. For offline development, you can use any HTTP request interceptor library that may exist. You can see the endpoints we hit in the source code, and if you want to log all of them:

const Storage = require('@google-cloud/storage')
const gcs = new Storage()

gcs.interceptors.push({
  request: reqOpts => {
    console.log(reqOpts)
    return reqOpts
  }
})

This will log all HTTP requests we make in the format the request module accepts.

Also, if you pass customEndpoint: true, it will skip the authentication step:

const Storage = require('@google-cloud/storage')
const gcs = new Storage({ customEndpoint: true })

Hopefully this is helpful. Feel free to ask any questions.

@ghost ghost removed the type: enhancement label Dec 27, 2017
@google-cloud-label-sync google-cloud-label-sync bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Jan 31, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants