Skip to content

Commit

Permalink
bump truss-transfer to 0.0.1 (#1342)
Browse files Browse the repository at this point in the history
* bump truss-transfer

* add truss transfer test
  • Loading branch information
michaelfeil authored Jan 29, 2025
1 parent 934bcbc commit bd655ef
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 32 deletions.
54 changes: 27 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ numpy = ">=1.23.5"
opentelemetry-api = ">=1.25.0"
opentelemetry-exporter-otlp = ">=1.25.0"
opentelemetry-sdk = ">=1.25.0"
truss_transfer="0.0.1rc4"
truss_transfer="0.0.1"
uvicorn = ">=0.24.0"
uvloop = ">=0.17.0"

Expand Down
15 changes: 11 additions & 4 deletions truss/tests/templates/core/server/test_lazy_data_resolver_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,29 @@ def test_lazy_data_resolver_v2():
# truss_transfer reads from LAZY_DATA_RESOLVER_PATH
if LAZY_DATA_RESOLVER_PATH.exists():
LAZY_DATA_RESOLVER_PATH.unlink()
with pytest.raises(Exception):
# LAZY_DATA_RESOLVER_PATH does not exist
# should raise an exception
LazyDataResolverV2(Path("/tmp")).fetch()

try:
LAZY_DATA_RESOLVER_PATH.mkdir(parents=True, exist_ok=True)
except Exception as e:
pytest.skip(f"Unable to create {LAZY_DATA_RESOLVER_PATH}: {e}")
pytest.skip(
f"Unable to create {LAZY_DATA_RESOLVER_PATH} due to missing os permissions: {e}"
)

# without LAZY_DATA_RESOLVER_PATH -> does not create folder / file
with tempfile.TemporaryDirectory() as tempdir:
data_dir = Path(tempdir)
resolver = LazyDataResolverV2(data_dir)
resolver = LazyDataResolverV2(data_dir).fetch()
assert not (data_dir / TARGET_FILE).exists()

# with LAZY_DATA_RESOLVER_PATH -> fetches data
with tempfile.TemporaryDirectory() as tempdir:
data_dir = Path(tempdir)
write_bptr_manifest_to_file()
resolver = LazyDataResolverV2(data_dir)
resolver = LazyDataResolverV2(data_dir).fetch()
resolver.fetch()
assert (data_dir / TARGET_FILE).exists()
assert (data_dir / TARGET_FILE).stat().st_size == 1482
Expand All @@ -63,7 +70,7 @@ def test_lazy_data_resolver_v2():
with tempfile.TemporaryDirectory() as tempdir:
data_dir = Path(tempdir)
write_bptr_manifest_to_file(expiration_timestamp=int(time.time()) - 1)
resolver = LazyDataResolverV2(data_dir)
resolver = LazyDataResolverV2(data_dir).fetch()
with pytest.raises(Exception):
resolver.fetch()

Expand Down

0 comments on commit bd655ef

Please sign in to comment.