*** Settings ***
Documentation    Integration tests for ResourceHandler sandbox and checkpoint lifecycle.
...              Exercises the checkpoint -> modify -> rollback cycle on real
...              temporary directories and git repos.
...              Issue #836: ResourceHandler sandbox and checkpoint methods.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
FsDirectory Checkpoint Rollback Cycle
    [Documentation]    FsDirectory: sandbox -> checkpoint -> modify -> rollback -> verify restored
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    fs-checkpoint-rollback    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    fs-checkpoint-rollback-ok

GitCheckout Checkpoint Rollback Cycle
    [Documentation]    GitCheckout: sandbox -> checkpoint -> modify -> rollback -> verify restored
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    git-checkpoint-rollback    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    git-checkpoint-rollback-ok
