Coder Social home page Coder Social logo

oittaa / fake-gcs-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fsouza/fake-gcs-server

0.0 1.0 0.0 1.34 MB

Google Cloud Storage emulator & testing library.

Home Page: https://pkg.go.dev/github.com/fsouza/fake-gcs-server/fakestorage?tab=doc

License: BSD 2-Clause "Simplified" License

Go 98.36% Dockerfile 0.35% Shell 1.29%

fake-gcs-server's Introduction

fake-gcs-server

Build Status GoDoc

fake-gcs-server provides an emulator for Google Cloud Storage API. It can be used as a library in Go projects and/or as a standalone binary/Docker image.

The library is available inside the package github.com/fsouza/fake-gcs-server/fakestorage and can be used from within test suites in Go package. The emulator is available as a binary that can be built manually, downloaded from the releases page or pulled from Docker Hub (docker pull fsouza/fake-gcs-server).

Using the emulator in Docker

You can stub/mock Google Cloud Storage as a standalone server (like the datastore/pubsub emulators) which is ideal for integration tests and/or tests in other languages you may want to run the fake-gcs-server inside a Docker container:

docker run -d --name fake-gcs-server -p 4443:4443 fsouza/fake-gcs-server

Preload data

In case you want to preload some data in fake-gcs-server just mount a folder in the container at /data:

docker run -d --name fake-gcs-server -p 4443:4443 -v ${PWD}/examples/data:/data fsouza/fake-gcs-server

Where the content of ${PWD}/examples/data is something like:

.
└── sample-bucket
    └── some_file.txt

To make sure everything works as expected you can execute these commands:

curl --insecure https://0.0.0.0:4443/storage/v1/b
{"kind":"storage#buckets","items":[{"kind":"storage#bucket","id":"sample-bucket","name":"sample-bucket"}],"prefixes":null}

curl --insecure https://0.0.0.0:4443/storage/v1/b/sample-bucket/o
{"kind":"storage#objects","items":[{"kind":"storage#object","name":"some_file.txt","id":"sample-bucket/some_file.txt","bucket":"sample-bucket","size":"33"}],"prefixes":[]}

This will result in one bucket called sample-bucket containing one object called some_file.txt.

Client library examples

For examples using the Python, Node.js and Go clients, check out the examples directory.

Building the image locally

You may use docker build to build the image locally instead of pulling it from Docker Hub:

docker build -t fsouza/fake-gcs-server .

fake-gcs-server's People

Contributors

antonydenyer avatar charleskorn avatar chowey avatar chrisrecalis avatar codelingobot avatar cuonglm avatar dcaba avatar dependabot-preview[bot] avatar dependabot[bot] avatar dobegor avatar fsouza avatar gh2k avatar gjabell avatar gracenoah avatar idanya avatar jwhitlock avatar kenniaa avatar kennytm avatar lelikg avatar mheffner avatar pschultz avatar renovate-bot avatar simondrake avatar snawaz avatar solidsystem avatar someone1 avatar teone avatar whiteley avatar zigius avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.