Skip to content

Commit

Permalink
Add S3 integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Chia committed Jul 3, 2024
1 parent 492a521 commit 83178b1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
26 changes: 26 additions & 0 deletions tests/integration/io/test_files_roundtrip_s3_minio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from __future__ import annotations

import pytest

import daft

from .conftest import minio_create_bucket


@pytest.mark.integration()
def test_files_roundtrip_minio_native_downloader(minio_io_config):
bucket_name = "my-bucket"
folder = f"s3://{bucket_name}/my-folder"
with minio_create_bucket(minio_io_config=minio_io_config, bucket_name=bucket_name):
bytes_data = [b"a", b"b", b"c"]
data = {"data": bytes_data}
df = daft.from_pydict(data)
df = df.with_column("file_paths", df["data"].bytes.upload_to_folder(folder, io_config=minio_io_config))
df.collect()

df = df.with_column("roundtrip_data", df["file_paths"].url.download(io_config=minio_io_config))
results = df.to_pydict()

assert results["data"] == results["roundtrip_data"] == bytes_data
for path, expected in zip(results["file_paths"], bytes_data):
assert path.startswith(folder)
13 changes: 0 additions & 13 deletions tests/integration/io/test_url_download_s3_minio.py

This file was deleted.

0 comments on commit 83178b1

Please sign in to comment.