Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions shard_core/data_model/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Profile(BaseModel):
delete_after: Optional[datetime] = None
vm_size: VMSize
max_vm_size: Optional[VMSize] = None
volume_size_gb: int | None = None
subscription: Optional[ShardSubscriptionSummary] = None

@classmethod
Expand All @@ -35,6 +36,7 @@ def from_shard(cls, shard: ShardBase):
max_vm_size=(
VMSize(shard.max_vm_size.value.lower()) if shard.max_vm_size else None
),
volume_size_gb=getattr(shard, "volume_size_gb", None),
subscription=getattr(shard, "subscription", None),
)

Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ async def app_client(mocker) -> AsyncGenerator[AsyncClient]:
status=ShardStatus.ASSIGNED,
shared_secret="foosecretbar",
cloud=Cloud.OVHCLOUD,
volume_size_gb=30,
)


Expand Down
8 changes: 8 additions & 0 deletions tests/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ async def test_profile_without_subscription_is_none(
response.raise_for_status()
profile = Profile.model_validate(response.json())
assert profile.subscription is None


async def test_profile_includes_volume_size_gb(requests_mock, app_client: AsyncClient):
response = await app_client.get("protected/management/profile")
response.raise_for_status()
profile = Profile.model_validate(response.json())
assert profile.volume_size_gb == conftest.mock_shard.volume_size_gb
assert profile.volume_size_gb == 30
Loading