v0.5.10: главная — полное руководство: задержка, сброс, fail-next, отладка, lifecycle
This commit is contained in:
@@ -92,31 +92,85 @@
|
||||
{% if stands_list|length > 1 %}<span class="muted">Стенд: <strong>{{ current_stand }}</strong></span>{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h3 class="h4">1. Получить список сервисов</h3>
|
||||
|
||||
<h3 class="h4">📡 Базовые команды</h3>
|
||||
|
||||
<p><strong>Получить список сервисов:</strong></p>
|
||||
<pre class="code-block"><code>curl -s {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/services | python3 -m json.tool</code></pre>
|
||||
|
||||
<h3 class="h4">2. Создать инстанс</h3>
|
||||
<p><strong>Создать инстанс:</strong></p>
|
||||
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instances \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"serviceId": 1, "displayName": "my-instance"}' | python3 -m json.tool</code></pre>
|
||||
|
||||
<h3 class="h4">3. Создать и запустить операцию</h3>
|
||||
<pre class="code-block"><code># Создать операцию
|
||||
<p><strong>Создать операцию, установить параметры, запустить:</strong></p>
|
||||
<pre class="code-block"><code># 1. Создать операцию (получить opUid из ответа)
|
||||
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instanceOperations \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"instanceUid": "<uid>", "operation": "create", "svcOperationId": 18}'
|
||||
|
||||
# Установить параметры
|
||||
# 2. Установить каждый параметр (повторить для всех)
|
||||
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instanceOperationCfsParams \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"instanceOperationUid": "<opUid>", "svcOperationCfsParamId": 242, "paramValue": "my-value"}'
|
||||
|
||||
# Запустить
|
||||
# 3. Запустить операцию (будет ждать {{ delay }}s)
|
||||
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instanceOperations/<opUid>/run</code></pre>
|
||||
|
||||
<h3 class="h4">4. Сбросить состояние</h3>
|
||||
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/reset \
|
||||
-H "X-Mock-Auth: test-token-123"</code></pre>
|
||||
<hr style="margin: 20px 0; border: none; border-top: 1px solid var(--border);">
|
||||
|
||||
<h3 class="h4">🛠 Управление полигоном (служебные эндпоинты)</h3>
|
||||
|
||||
<div class="feature-grid">
|
||||
<div class="feature-item">
|
||||
<h4>⏱ Задержка операций</h4>
|
||||
<p>Каждый <code>POST /run</code> ждёт <strong>{{ delay }} секунд</strong> перед ответом — эмуляция времени выполнения в облаке.</p>
|
||||
<p><strong>Текущая:</strong> <code>{{ delay }}s</code></p>
|
||||
<pre class="code-block"><code># Сделать операции мгновенными
|
||||
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/delay/0
|
||||
|
||||
# Поставить задержку 3 секунды
|
||||
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/delay/3
|
||||
|
||||
# Максимум — 5 секунд (защита healthcheck'а)</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="feature-item">
|
||||
<h4>🧹 Сброс состояния</h4>
|
||||
<p>Удаляет <strong>все</strong> инстансы и операции на текущем стенде. Полезно перед каждым тестом.</p>
|
||||
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/reset</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="feature-item">
|
||||
<h4>💥 Симуляция ошибок</h4>
|
||||
<p>Следующий <code>POST /run</code> <strong>упадёт</strong> с ошибкой. One-shot: после использования флаг сбрасывается.</p>
|
||||
<pre class="code-block"><code># Включить
|
||||
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/fail-next
|
||||
|
||||
# Следующий run → {"ok": false, "error": "mock failure..."}
|
||||
# После этого — снова работает нормально</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="feature-item">
|
||||
<h4>📊 Отладка</h4>
|
||||
<p>Посмотреть текущее состояние всех инстансов и операций:</p>
|
||||
<pre class="code-block"><code>curl -s {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/state | python3 -m json.tool</code></pre>
|
||||
<p>Список загруженных сервисов:</p>
|
||||
<pre class="code-block"><code>curl -s {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/services | python3 -m json.tool</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr style="margin: 20px 0; border: none; border-top: 1px solid var(--border);">
|
||||
|
||||
<h3 class="h4">🔁 Жизненный цикл операции</h3>
|
||||
<ol style="line-height: 2;">
|
||||
<li><code>GET /instanceOperations/default/{svcOperationId}</code> — узнать какие параметры нужны</li>
|
||||
<li><code>POST /instanceOperations</code> — создать операцию (получить opUid)</li>
|
||||
<li><code>POST /instanceOperationCfsParams</code> × N — установить каждый параметр</li>
|
||||
<li><code>GET /{opUid}/validate-cfs</code> — проверить корректность</li>
|
||||
<li><code>POST /{opUid}/run</code> — выполнить (ждёт <strong>{{ delay }}s</strong>)</li>
|
||||
<li><code>GET /{opUid}?fields=dtFinish,isSuccessful</code> — проверить результат</li>
|
||||
</ol>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user