Skip to content

Commit

Permalink
Add more functionality testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
ssyssy committed Apr 22, 2024
1 parent 2977f83 commit c2b725f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def docker_alluxio_with_etcd():
# assume we already have a server already set up
yield os.getenv("ALLUXIO_URL")
return
launch_alluxio_dockers(True)
launch_alluxio_dockers(with_etcd=True)
yield yield_url()
stop_alluxio_dockers(True)

Expand Down
22 changes: 21 additions & 1 deletion tests/fs/test_docker_fsspec_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging

LOGGER = logging.getLogger(__name__)
FILE_PATH = "/opt/alluxio/ufs/test.csv"


def validate_read_range(
Expand Down Expand Up @@ -45,7 +46,24 @@ def validate_read_range(
def alluxio_fsspec_cat_file(alluxio_file_system, alluxio_path, local_path):
file_size = os.path.getsize(local_path)

alluxio_file_system.ls(alluxio_path)
file_list = alluxio_file_system.ls(alluxio_path)
assert len(file_list) == 1
assert file_list[0].get("name") == FILE_PATH
assert file_list[0].get("type") == "file"
assert file_list[0].get("size") == 6569089
file_info = alluxio_file_system.info(alluxio_path)
assert file_info.get("name") == FILE_PATH
assert file_info.get("type") == "file"
assert file_info.get("size") == 6569089
assert not alluxio_file_system.isdir(alluxio_path)
assert alluxio_file_system.isfile(alluxio_path)

with alluxio_file_system.open(alluxio_path) as f:
alluxio_file_data = f.read()

with open(local_path, "rb") as local_file:
local_file_data = local_file.read()
assert local_file_data == alluxio_file_data

# Validate normal case
max_length = 13 * 1024
Expand Down Expand Up @@ -89,6 +107,8 @@ def test_alluxio_fsspec_cat_file(alluxio_file_system: AlluxioFileSystem):
alluxio_file_system, "alluxio::" + ALLUXIO_FILE_PATH, LOCAL_FILE_PATH
)

alluxio_fsspec_cat_file(alluxio_file_system, FILE_PATH, LOCAL_FILE_PATH)


def test_etcd_alluxio_fsspec_cat_file(
etcd_alluxio_file_system: AlluxioFileSystem,
Expand Down

0 comments on commit c2b725f

Please sign in to comment.