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 cf00b01
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 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,37 @@ 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,
}
temp = Path(tempfile.NamedTemporaryFile(suffix=".onnx", delete=False).name)
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 cf00b01

Please sign in to comment.