*** Settings ***
Documentation    Integration tests for repo indexing service (issue #195).
...              Verifies full indexing, incremental refresh, and policy enforcement.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Full Index With Language Detection And Persistence
    [Documentation]    Index a sample directory, verify file count, language, and persistence.
    [Tags]    feature195
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    full-index    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}    repo-indexing-full-ok

Incremental Refresh Detects Changed Files
    [Documentation]    Modify a file and verify incremental refresh detects the change.
    [Tags]    feature195
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    incremental-refresh    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}    repo-indexing-refresh-ok

Policy Enforcement And Index Removal
    [Documentation]    Verify max_file_size, include_globs, and removal.
    [Tags]    feature195
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    policy-enforcement    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}    repo-indexing-policy-ok
