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

Python API inside a Docker container fails #190

Open
swarmt opened this issue Jul 16, 2022 · 1 comment
Open

Python API inside a Docker container fails #190

swarmt opened this issue Jul 16, 2022 · 1 comment

Comments

@swarmt
Copy link

swarmt commented Jul 16, 2022

Describe the bug
Using the Python API example works perfectly in a virtual environment.
Fails when run in a docker container with a time out.
HTTPConnectionPool(host='172.17.0.1', port=63342): Max retries exceeded with url:

To Reproduce

import os
import pathlib as pl
import shutil

import pytest
from gcp_storage_emulator.server import create_server
from google.auth.credentials import AnonymousCredentials
from google.cloud import storage

import upload


@pytest.fixture
def mock_storage_client():
    """Google Cloud Storage emulator"""
    host = "localhost"
    port = 9023
    server = create_server(host, port, in_memory=True)
    server.start()
    os.environ["STORAGE_EMULATOR_HOST"] = f"http://{host}:{port}"
    yield storage.Client(credentials=AnonymousCredentials(), project="test-project")
    server.stop()
    del os.environ["STORAGE_EMULATOR_HOST"]


def test_upload_folder(mock_storage_client):
    """Test uploading a folder to Google Cloud Storage"""
    bucket_name = "test-upload-bucket"
    mock_storage_client.create_bucket(bucket_name)

Expected behavior
Bucket is created.

System (please complete the following information):

  • OS version: macos / linux
  • Python version: 3.9
  • gcp-storage-emulator version: latest

Additional context
Add any other context about the problem here.

@tdeg
Copy link

tdeg commented Aug 18, 2022

@swarmt did you ever find a work around for this issue?

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

No branches or pull requests

2 participants