
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gcloud-storage-emulator
Advanced tools
Google doesn't (yet) ship an emulator for the Cloud Storage API like they do for Cloud Datastore.
This is a stub emulator so you can run your tests and do local development without having to connect to the production Storage APIs.
THIS IS A WORK IN PROGRESS AND ONLY SUPPORTS A LIMITED SUBSET OF THE API
Potato offers Commercial Support for all its Open Source projects and we can tailor a support package to your needs.
If you're interested in commercial support, training, or consultancy then go ahead and contact us at opensource@potatolondon.com
pip install gcloud-storage-emulator
Start the emulator with:
$ gcloud-storage-emulator start --port=9090
By default, data is stored under $PWD/.cloudstorage
. You can configure the folder using the env variables STORAGE_BASE
and STORAGE_DIR
.
If you wish to run the emulator in a testing environment or if you don't want to persist any data, you can use the --no-store-on-disk
parameter. For tests, you might want to consider starting up the server from your code (see the Python APIs)
If you're using the Google client library (e.g. google-cloud-storage
for Python) then you can set the STORAGE_EMULATOR_HOST
environment variable to tell the library to connect to your emulator endpoint rather than the standard https://storage.googleapis.com
, e.g.:
$ export STORAGE_EMULATOR_HOST=http://localhost:9090
You can wipe the data by running
$ gcloud-storage-emulator wipe
You can pass --keep-buckets
to wipe the data while keeping the buckets.
To start a server from your code you can do
from gcloud_storage_emulator.server import create_server
server = create_server("localhost", 9023, in_memory=False)
server.start()
# ........
server.stop()
You can wipe the data (e.g. for text execution) by calling server.wipe()
This can also be achieved (e.g. during tests) by hitting the /wipe
endpoint
If you have Tox installed then you can run tests with:
tox -e py37 -- {extra_pytest_args}
If you don't have Tox installed on your system but you do have Docker, then you can run the tests using the themattrix/tox image:
docker run -v /ABSOLUTE/PATH/TO/THIS/REPO/ON/YOUR/MACHINE:/app themattrix/tox tox -e py37 [optional additional args for tox...]
cd
into the repository directorypip install -e
python -m unittest gcloud_storage_emulator.tests
FAQs
A stub emulator for the Google Cloud Storage API
We found that gcloud-storage-emulator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.