fix: harden Polygon operation validation
This commit is contained in:
@@ -84,6 +84,20 @@ class TestInstanceOperations:
|
||||
assert inst["state"]["params"]["resourceRealm"] == "dummy"
|
||||
assert inst["state"]["params"]["durationMs"] == "0"
|
||||
|
||||
def test_create_applies_supplied_operation_params(self):
|
||||
"""Параметры create перекрывают дефолты из stateParams."""
|
||||
st = mock_state.state
|
||||
uid = st.create_instance(1, "test", SERVICES[1])
|
||||
op_uid = st.create_operation(uid, 18, "create", "instance", "create")
|
||||
st.set_param(op_uid, 242, "custom-realm")
|
||||
st.set_param(op_uid, 198, "999")
|
||||
|
||||
state_machine.apply_effect(op_uid, st, SERVICES)
|
||||
|
||||
inst = st.get_instance(uid)
|
||||
assert inst["state"]["params"]["resourceRealm"] == "custom-realm"
|
||||
assert inst["state"]["params"]["durationMs"] == "999"
|
||||
|
||||
def test_create_sets_state_out(self):
|
||||
"""create → state.out из шаблона (пустой для dummy, заполнен для pg)."""
|
||||
uid, _ = _create_and_run(90, "pg", 19, "create")
|
||||
@@ -92,10 +106,13 @@ class TestInstanceOperations:
|
||||
assert "databases" in inst["state"]["out"]
|
||||
|
||||
def test_delete_removes_instance(self):
|
||||
"""delete → инстанс удалён."""
|
||||
uid, _ = _create_and_run(1, "test", 18, "create")
|
||||
_run_op(uid, 71, "delete", action="delete")
|
||||
"""delete удаляет инстанс, но сохраняет историю операций для polling."""
|
||||
uid, create_op_uid = _create_and_run(1, "test", 18, "create")
|
||||
delete_op_uid = _run_op(uid, 71, "delete", action="delete")
|
||||
assert mock_state.state.get_instance(uid) is None
|
||||
assert create_op_uid in mock_state.state.operations
|
||||
assert delete_op_uid in mock_state.state.operations
|
||||
assert delete_op_uid in mock_state.state.op_params
|
||||
|
||||
def test_suspend_sets_suspended(self):
|
||||
"""suspend → статус suspended."""
|
||||
|
||||
Reference in New Issue
Block a user