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

feat(gcsfs/core): support storage_emulator_host for http requests #424

Merged
merged 11 commits into from
Oct 22, 2021

Conversation

awill1988
Copy link
Contributor

@awill1988 awill1988 commented Oct 15, 2021

Add support for specifying GCS emulator for this library.

I assume generating signed urls will not work, but for all other requests it should work fine.

While GCP does not release an official gcs emulator, there are a few community-driven projects:

The official python library does have support for STORAGE_EMULATOR_HOST

Fixes #424

@martindurant
Copy link
Member

Can this be used to replace all of the vcrpy test code and recordings? Happy to use whichever emulator makes that possible.

@awill1988
Copy link
Contributor Author

I'm not sure.. I don't have any experience with vcrpy. For my use case, I typically use a docker-compose stack to spin up those emulators. I have only used fake-gcs-emulator. Here's an example command for that:

docker run -p 4443:4443 fsouza/fake-gcs-server:latest -scheme http -public-host http://localhost:4443 -external-url http://localhost:4443

The reason for the change is because I'm leveraging this project in pyarrow and having the option lets me validate things locally. Really awesome project you guys have here!

Feel free to add commits or point me in the direction to update vcrpy tests.. I'd have to find some free time to look at migrating away from it to a emulation approach

@martindurant
Copy link
Member

It would be super simple! Simply remove everything to do with vcrpy, and do exactly as you say, spin up a docker container as a pytest global fixture, and set the env variable to point at it. I can have a go at this myself next week, if you don't fancy it.

@awill1988
Copy link
Contributor Author

I'll take a peek this weekend if I find a window of time. Otherwise I'll check-in next week. I'm good either way. At work I context switch a lot between Python, Go, Elixir so I don't feel the level of confidence I typically feel as prior to this job it was Typescript/JS. 😭 so many languages..

@martindurant
Copy link
Member

I have started to move the tests to the emulator as opposed to vcrpy!
This will currently fail hard, as I've only done test_mapping, but so far so good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants