Skip to content

Commit 3b637eb

Browse files
Merge pull request #16 from MagaluCloud/update-block
chore: update block storage tests
2 parents 7cf0ffc + 03bd819 commit 3b637eb

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

tests/test_block.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import pytest
23
import random
34
import time
@@ -66,7 +67,7 @@ def test_bs_snapshots_create():
6667
"create",
6768
f"--name=test-snapshot-{random.randint(0, 9999)}",
6869
"--description='just for testing'",
69-
f"--volume.id={block_test_context.get('volume_id')}",
70+
f"--volume.id={block_test_context['volume_id']}",
7071
]
7172
)
7273
assert exit_code == 0, stderr
@@ -112,6 +113,57 @@ def test_bs_snapshots_delete():
112113
time.sleep(10)
113114

114115

116+
def test_bs_schedulers_create():
117+
exit_code, _, stderr, jsonout = run_cli(
118+
[
119+
"bs",
120+
"schedulers",
121+
"create",
122+
"--name=test-scheduler",
123+
"--policy.frequency.daily.start-time='14:00:00'",
124+
"--policy.retention-in-days=10",
125+
"--snapshot.type=object",
126+
]
127+
)
128+
assert exit_code == 0, stderr
129+
assert "id" in jsonout
130+
131+
block_test_context["scheduler_id"] = jsonout["id"]
132+
133+
134+
def test_bs_schedulers_list():
135+
exit_code, _, stderr, jsonout = run_cli(["bs", "schedulers", "list"])
136+
assert exit_code == 0, stderr
137+
assert "schedulers" in jsonout
138+
assert len(jsonout["schedulers"]) > 0
139+
140+
141+
def test_bs_schedulers_get():
142+
exit_code, _, stderr, jsonout = run_cli(
143+
["bs", "schedulers", "get", block_test_context["scheduler_id"]]
144+
)
145+
assert exit_code == 0, stderr
146+
147+
assert "id" in jsonout
148+
assert "name" in jsonout
149+
assert "state" in jsonout
150+
151+
assert jsonout["name"] == "test-scheduler"
152+
153+
154+
def test_bs_schedulers_delete():
155+
exit_code, _, stderr, jsonout = run_cli(
156+
[
157+
"bs",
158+
"schedulers",
159+
"delete",
160+
block_test_context["scheduler_id"],
161+
"--no-confirm",
162+
]
163+
)
164+
assert exit_code == 0, stderr
165+
166+
115167
def test_bs_volumes_delete():
116168
exit_code, _, stderr, jsonout = run_cli(
117169
["bs", "volumes", "delete", block_test_context["volume_id"], "--no-confirm"]

0 commit comments

Comments
 (0)