Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
isinyaaa committed Oct 2, 2024
1 parent 9643fe1 commit fa44a6f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ site

# E2E
venv
temp
33 changes: 33 additions & 0 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import subprocess
import tempfile
from pathlib import Path

Expand Down Expand Up @@ -64,6 +65,38 @@ def update(self, _, event: Event) -> None:
assert e0.metadata == ModelMetadata.from_dict(md)


def test_push_pull_chunked(tmp_path, target):
omlmd = Helper()

md = {
"name": "mnist",
"description": "Lorem ipsum",
"author": "John Doe",
"accuracy": 0.987,
}
here = Path.cwd()
temp = here / "temp"
base_size = 16 * 1024 * 1024 * 3 # 48MB
try:
subprocess.run(
[
"dd",
"if=/dev/null",
f"of={temp}",
"bs=1",
"count=0",
f"seek={base_size}",
],
)

omlmd.push(target, temp, **md)
omlmd.pull(target, tmp_path)
assert len(list(tmp_path.iterdir())) == 3
assert tmp_path.joinpath(temp.name).stat().st_size == base_size
finally:
temp.unlink()


@pytest.mark.e2e
def test_e2e_push_pull(tmp_path, target):
omlmd = Helper()
Expand Down

0 comments on commit fa44a6f

Please sign in to comment.