Skip to content

Commit

Permalink
Somewhat working azurite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton committed Feb 9, 2024
1 parent 1e03fd6 commit ab01cca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
9 changes: 7 additions & 2 deletions python/pyarrow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ def azure_server(tmpdir_factory):
port = find_free_port()
env = os.environ.copy()
tmpdir = tmpdir_factory.getbasetemp()
args = ['azurite', '--quiet', "--location", tmpdir]
# Port 0 means azurite will select any free port. We don't need to connect
# to the queue or table services, we just need them to not conflict with
# other ports.
# TODO(tomnewton): Get a suiteable debug tmpdir
args = ['azurite', "--location", tmpdir, "--blobPort", str(port),
"--queuePort", "0", "--tablePort", "0", "--debug", "/tmp/azurite_debug/"]
proc = None
try:
proc = subprocess.Popen(args, env=env)
Expand All @@ -272,7 +277,7 @@ def azure_server(tmpdir_factory):
pytest.skip(f"Command {args} failed to execute: {e}")
else:
yield {
'connection': ('localhost', port),
'connection': ('127.0.0.1', port),
'process': proc,
'tempdir': tmpdir,
}
Expand Down
13 changes: 8 additions & 5 deletions python/pyarrow/tests/test_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,16 @@ def azurefs(request, azure_server):
from pyarrow.fs import AzureFileSystem

host, port = azure_server['connection']
azureite_authority = f"{host}:{port}"
azureite_scheme = "http"

container = 'pyarrow-filesystem/'

fs = AzureFileSystem(account_name='devstoreaccount1')
try:
fs.create_dir(container)
except OSError as e:
pytest.skip(f"Could not create directory in {fs}: {e}")
fs = AzureFileSystem(account_name='devstoreaccount1', account_key='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==',
blob_storage_authority=azureite_authority, dfs_storage_authority=azureite_authority,
blob_storage_scheme=azureite_scheme, dfs_storage_scheme=azureite_scheme)

fs.create_dir(container)

yield dict(
fs=fs,
Expand Down

0 comments on commit ab01cca

Please sign in to comment.