Skip to content

Commit 8a3d16b

Browse files
committed
add tests for iops and storage resize
1 parent 67f19e3 commit 8a3d16b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/test_branches.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def test_branch_resize(client, org, project, branch_id):
163163
"ACTIVE_HEALTHY",
164164
BRANCH_TIMEOUT_SEC,
165165
)
166+
r = client.get(f"organizations/{org}/projects/{project}/branches/{branch_id}/")
167+
assert r.status_code == 200
168+
assert r.json()["max_resources"]["iops"] == 2000
166169

167170

168171
def test_branch_resize_cpu(client, org, project, branch_id):
@@ -222,6 +225,27 @@ def test_branch_resize_database_size(client, org, project, branch_id):
222225
assert r.json()["max_resources"]["nvme_bytes"] == seven_gb
223226

224227

228+
def test_branch_resize_storage_size(client, org, project, branch_id):
229+
# 2 GB expressed in bytes (must be a multiple of 1 GB)
230+
two_gb = 2 * 1_000_000_000
231+
# due to GiB rounding by the storage backend: 2 GB -> 2 GiB -> rounds up to 3 GB
232+
three_gb = 3 * 1_000_000_000
233+
r = client.post(
234+
f"organizations/{org}/projects/{project}/branches/{branch_id}/resize",
235+
json={"storage_size": two_gb},
236+
)
237+
assert r.status_code == 202
238+
wait_for_status(
239+
client,
240+
f"organizations/{org}/projects/{project}/branches/{branch_id}/",
241+
"ACTIVE_HEALTHY",
242+
BRANCH_TIMEOUT_SEC,
243+
)
244+
r = client.get(f"organizations/{org}/projects/{project}/branches/{branch_id}/")
245+
assert r.status_code == 200
246+
assert r.json()["max_resources"]["storage_bytes"] == three_gb
247+
248+
225249
def test_branch_password_reset(client, org, project, branch_id):
226250
r = client.post(
227251
f"organizations/{org}/projects/{project}/branches/{branch_id}/reset-password",

0 commit comments

Comments
 (0)