Support additional XML API endpoints
Opened this issue · 2 comments
Hi Full Story Dev,
From scouring the interwebs, it's my opinion that this is the highest quality open source GCS emulator available today. Thank you!!
My Goal
For one of my projects, I've leveraging the https://github.com/ncruces/go-gcp/gmutex
package to do some distributed locking. I'd love to be able to run integration tests against the gcsemu cli to avoid needing credentials and improve test execution time.
My Problem
However, that package relies on the following Google Cloud Storage XML API endpoints which are not available in this project yet:
- HEAD Object
- Simple PUT Object
- Compose PUT Object
Proposed Solution
Would you be willing to accept a contribution that added support for these endpoints? I've been hacking on a fork and making some progress.
Since the XML API has some differences in how conditions are passed to the server via query params and a different path structure, I'd probably:
- rename the existing
g.Handler()
->g.JsonHandler()
for these routes: https://github.com/fullstorydev/emulators/blob/master/storage/gcsemu/parse.go#L9-L14 - add a new
g.XmlHandler()
for these routes: https://github.com/fullstorydev/emulators/blob/master/storage/gcsemu/parse.go#L16
I'd probably use the test suite for this project and from gmutex
and examining the docs to validate I've implemented the behavior correctly.
I understand this is a big ask, and I completely understand if you'd rather decline a contribution of this nature. Let me know if you're willing to consider and discuss. Many thanks for all the excellent work on this project to date!
Hi Bryce, glad you're finding this useful! We can definitely accept contributions to add more GCS API surface area.
My advice would be to check out TestRealStore
-- the idea is that you create a test bucket in real GCS that you have access to, provide it as an environment variable, and then run tests against the real bucket. This validates that your tests are correct and useful. Then you can implement changes to the emulator to get your new tests to pass.
Oh, I love this! That's incredible. I'll start looking into using TestRealStore
to getting working tests. This is an impressive way to approach this project!