-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f918e39
commit 04511f3
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pytest | ||
|
||
from datachain.client import Client | ||
from datachain.lib.dc import DataChain | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"src_cloud_type,dst_cloud_type", | ||
[ | ||
("azure", "gs"), | ||
("gs", "azure"), | ||
("s3", "gs"), | ||
("gs", "s3"), | ||
], | ||
indirect=["src_cloud_type"], | ||
) | ||
def test_cross_cloud_transfer( | ||
cloud_test_catalog_upload, | ||
cloud_type, | ||
src_cloud_type, | ||
dst_cloud_type, | ||
tmp_upath_factory, | ||
): | ||
# Setup source and destination paths | ||
src_path = tmp_upath_factory.mktemp(src_cloud_type) | ||
dst_path = tmp_upath_factory.mktemp(dst_cloud_type) | ||
|
||
# Create test file in source | ||
test_content = b"test content" | ||
(src_path / "test.txt").write_bytes(test_content) | ||
|
||
# Create DataChain and transfer | ||
ds = DataChain.from_storage(f"{src_cloud_type}://{src_path}/test.txt") | ||
ds.to_storage(f"{dst_cloud_type}://{dst_path}/destination", placement="filename") | ||
|
||
# Verify transfer | ||
dst_client = Client.get_client(f"{dst_cloud_type}://{dst_path}", None) | ||
assert dst_client.fs.exists(f"{dst_path}/destination/test.txt") | ||
|
||
transferred_content = dst_client.fs.read_bytes(f"{dst_path}/destination/test.txt") | ||
assert transferred_content == test_content |