Files
gpu-rent/tests/test_resize.py
T
Leonid Pershin a563ae06c4 Bump version to 0.2.0 and enhance documentation
- Updated version number in pyproject.toml and __init__.py to 0.2.0.
- Revised README.md to reflect the current state of the project, including usage instructions and setup steps.
- Improved CLI documentation in cli.md, adding details about new commands and their functionalities.
- Enhanced the quick start section in README.md for better clarity on initial setup.
- Updated local folder documentation to clarify file handling and commands.
- Added a new command for listing GPU flavors and improved error handling in the CLI.
- Implemented a watchdog feature in the tunnel to manage server states effectively.
2026-08-21 03:38:01 +03:00

33 lines
856 B
Python

import pytest
from gpu_rent.errors import GpuRentError
from gpu_rent.resize import resize_data_volume
from gpu_rent.state import SessionState, save_state
class _Cfg:
pass
def test_resize_rejects_shrink(monkeypatch):
save_state(SessionState(data_volume_id="d1", floating_ip=None))
class Vol:
id = "d1"
size = 200
status = "in-use"
class Conn:
class block_storage:
@staticmethod
def get_volume(vid):
return Vol()
@staticmethod
def extend_volume(*a, **k):
raise AssertionError("no extend")
monkeypatch.setattr("gpu_rent.resize.connect", lambda cfg: Conn())
with pytest.raises(GpuRentError, match="вниз нельзя"):
resize_data_volume(_Cfg(), 100, log=lambda m: None)