*** Settings ***
Documentation    TDD Bug #797 -- actor list should not cause a database update
...              Integration smoke tests verifying that the ``actor list``
...              command does not trigger ``upsert_actor()`` or
...              ``set_default_actor()`` calls.  The bug has been fixed;
...              these tests serve as permanent regression guards.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_tdd_actor_list_no_db_update.py

*** Test Cases ***
TDD Actor List Does Not Call Upsert Actor
    [Documentation]    Verify that ``actor list`` does not call
    ...                ``upsert_actor()`` on the actor service.
    ...                Bug #797: ``list_actors()`` calls
    ...                ``ensure_built_in_actors()`` which writes to the DB.
    [Tags]  tdd_bug    tdd_bug_797    tdd_issue    tdd_issue_797    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-no-upsert
    ...    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-actor-list-no-db-update-no-upsert-ok

TDD Actor List Does Not Call Set Default Actor
    [Documentation]    Verify that ``actor list`` does not call
    ...                ``set_default_actor()`` on the actor service.
    ...                Bug #797: ``ensure_built_in_actors()`` may also
    ...                call ``set_default_actor()`` — another DB write.
    [Tags]  tdd_bug    tdd_bug_797    tdd_issue    tdd_issue_797    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-no-set-default
    ...    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-actor-list-no-db-update-no-set-default-ok
