*** Settings ***
Documentation    Smoke tests for ACMS Context Tiers (hot/warm/cold)
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Tier Model Construction
    [Documentation]    Verify ContextTier, ActorRole, TieredFragment creation
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    models    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-models-ok

Store And Retrieve Fragment
    [Documentation]    Verify storing and retrieving a fragment from the tier service
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    store-get    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-store-get-ok

Promote And Demote
    [Documentation]    Verify tier promotion and demotion
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    promote-demote    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-promote-demote-ok

LRU Eviction
    [Documentation]    Verify LRU eviction from hot tier
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    eviction    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-eviction-ok

Actor Views
    [Documentation]    Verify per-actor filtered views
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    actor-views    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-actor-views-ok

Project Scoping
    [Documentation]    Verify ScopedBackendView filters by project
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    scoping    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-scoping-ok

DI Container Resolution
    [Documentation]    Verify DI container provides context_tier_service
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    di-resolution    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-tiers-di-ok
