- Updated .gitignore to include gpu-rent.vars. - Modified env.example to introduce the UPDATE_GIT variable for controlling git updates during execution. - Implemented Import-GpuRentVars function in gpu-rent.ps1 to load environment variables from gpu-rent.vars. - Enhanced gpu-rent.sh to support loading variables from gpu-rent.vars and added logic for handling default and extra arguments. - Updated CLI documentation to reflect the new gpu-rent.vars file and its usage in configuration. - Improved bootstrap and provisioning logic to conditionally perform git updates based on the new configuration.
36 lines
1020 B
Python
36 lines
1020 B
Python
from pathlib import Path
|
|
|
|
from gpu_rent.remote.civitai_fetch import should_skip
|
|
|
|
|
|
def test_should_skip_missing(tmp_path: Path):
|
|
skip, _ = should_skip(tmp_path / "nope.safetensors", "abc")
|
|
assert skip is False
|
|
|
|
|
|
def test_should_skip_exists_no_sha(tmp_path: Path):
|
|
dest = tmp_path / "a.safetensors"
|
|
dest.write_bytes(b"weights")
|
|
skip, reason = should_skip(dest, "")
|
|
assert skip is True
|
|
assert "уже есть" in reason
|
|
|
|
|
|
def test_should_skip_sha_match(tmp_path: Path):
|
|
dest = tmp_path / "a.safetensors"
|
|
dest.write_bytes(b"weights")
|
|
import hashlib
|
|
|
|
digest = hashlib.sha256(b"weights").hexdigest()
|
|
skip, reason = should_skip(dest, digest)
|
|
assert skip is True
|
|
assert "sha ok" in reason
|
|
|
|
|
|
def test_should_not_skip_bad_sha(tmp_path: Path):
|
|
dest = tmp_path / "a.safetensors"
|
|
dest.write_bytes(b"weights")
|
|
skip, reason = should_skip(dest, "deadbeef" * 8)
|
|
assert skip is False
|
|
assert "перекачиваю" in reason
|