Files
cleveragents-core/robot/context_delete_all_yes.robot
T
brent.edwards e8aa5ac268
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 28s
CI / security (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 15s
CI / integration_tests (pull_request) Failing after 6m25s
CI / build (pull_request) Successful in 15s
CI / unit_tests (pull_request) Successful in 6m52s
CI / docker (pull_request) Successful in 9s
CI / coverage (pull_request) Successful in 5m5s
fix(ci): restore venv PATH, use absolute resource paths, and add timeouts in robot tests
- Restore session.env["PATH"] in integration_tests nox session to ensure
  Run Process uses venv Python instead of system Python
- Convert bare Resource references to ${CURDIR}/ absolute paths across
  30 robot files to fix CI resolution failures
- Add timeout=30s to all Run Process calls in rxpy_route_validation.robot
  to prevent hanging tests
- Tag 2 rxpy tests as slow (require running actors unavailable on CI)
- Fix LangGraph test to use correct config file (LANGGRAPH_CONFIG)
- All 204 tests pass (4 excluded: 2 slow + 2 discovery)
2026-02-13 02:42:57 +00:00

336 lines
12 KiB
Plaintext

*** Settings ***
Documentation Integration tests for context delete with --all and --yes flags
Library Process
Library OperatingSystem
Library String
Library DateTime
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Settings ***
Resource ${CURDIR}/v2_paths.resource
*** Variables ***
${SIMPLE_CONFIG} ${V2_CONFIG_DIR}/simple_echo_config.yaml
${CONTEXT_DIR} ${TEMPDIR}/test_contexts_delete_all_yes
${UNIQUE_ID} ${EMPTY}
${TEMP} ${EMPTY}
*** Test Cases ***
Test Delete Single Context With Yes Flag
[Documentation] Test context delete with --yes bypasses confirmation
${context_name} = Set Variable delete_yes_${UNIQUE_ID}
# Create context
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${context_name}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test message"
Directory Should Exist ${CONTEXT_DIR}/${context_name}
# Delete it with --yes flag
${result} = Run Process python -m cleveragents context delete
... ${context_name}
... --context-dir ${CONTEXT_DIR}
... --yes
Should Be Equal As Integers ${result.rc} 0
Directory Should Not Exist ${CONTEXT_DIR}/${context_name}
Should Contain ${result.stdout} deleted
Test Delete Single Context With Short Yes Flag
[Documentation] Test context delete with -y shorthand flag
${context_name} = Set Variable delete_short_${UNIQUE_ID}
# Create context
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${context_name}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test message"
Directory Should Exist ${CONTEXT_DIR}/${context_name}
# Delete it with -y flag
${result} = Run Process python -m cleveragents context delete
... ${context_name}
... --context-dir ${CONTEXT_DIR}
... -y
Should Be Equal As Integers ${result.rc} 0
Directory Should Not Exist ${CONTEXT_DIR}/${context_name}
Test Delete Single Context With Confirmation Accept
[Documentation] Test context delete with confirmation accepted
${context_name} = Set Variable delete_confirm_${UNIQUE_ID}
# Create context
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${context_name}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test message"
Directory Should Exist ${CONTEXT_DIR}/${context_name}
# Delete with confirmation (answer 'y')
${result} = Run Process python -m cleveragents context delete
... ${context_name}
... --context-dir ${CONTEXT_DIR}
... stdin=y\n
Should Be Equal As Integers ${result.rc} 0
Directory Should Not Exist ${CONTEXT_DIR}/${context_name}
Test Delete Single Context With Confirmation Reject
[Documentation] Test context delete with confirmation rejected
${context_name} = Set Variable delete_reject_${UNIQUE_ID}
# Create context
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${context_name}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test message"
Directory Should Exist ${CONTEXT_DIR}/${context_name}
# Delete with confirmation rejected (answer 'n')
${result} = Run Process python -m cleveragents context delete
... ${context_name}
... --context-dir ${CONTEXT_DIR}
... stdin=n\n
Should Be Equal As Integers ${result.rc} 0
Directory Should Exist ${CONTEXT_DIR}/${context_name}
Should Contain ${result.stdout} cancelled
Test Delete All Contexts With All And Yes Flags
[Documentation] Test delete all contexts with --all --yes
[Setup] Empty Directory ${CONTEXT_DIR}
${ctx1} = Set Variable all_ctx1_${UNIQUE_ID}
${ctx2} = Set Variable all_ctx2_${UNIQUE_ID}
${ctx3} = Set Variable all_ctx3_${UNIQUE_ID}
# Create multiple contexts
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx1}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx2}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx3}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Directory Should Exist ${CONTEXT_DIR}/${ctx1}
Directory Should Exist ${CONTEXT_DIR}/${ctx2}
Directory Should Exist ${CONTEXT_DIR}/${ctx3}
# Delete all with --all --yes
${result} = Run Process python -m cleveragents context delete
... --all
... --yes
... --context-dir ${CONTEXT_DIR}
Should Be Equal As Integers ${result.rc} 0
Directory Should Not Exist ${CONTEXT_DIR}/${ctx1}
Directory Should Not Exist ${CONTEXT_DIR}/${ctx2}
Directory Should Not Exist ${CONTEXT_DIR}/${ctx3}
Should Contain ${result.stdout} Deleted 3 context
Test Delete All With Confirmation Accept
[Documentation] Test delete all with confirmation accepted
[Setup] Empty Directory ${CONTEXT_DIR}
${ctx1} = Set Variable all_confirm1_${UNIQUE_ID}
${ctx2} = Set Variable all_confirm2_${UNIQUE_ID}
# Create contexts
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx1}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx2}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
# Delete all with confirmation
${result} = Run Process python -m cleveragents context delete
... --all
... --context-dir ${CONTEXT_DIR}
... stdin=y\n
Should Be Equal As Integers ${result.rc} 0
Directory Should Not Exist ${CONTEXT_DIR}/${ctx1}
Directory Should Not Exist ${CONTEXT_DIR}/${ctx2}
Should Contain ${result.stdout} Found
Should Contain ${result.stdout} to delete
Test Delete All With Confirmation Reject
[Documentation] Test delete all with confirmation rejected
[Setup] Empty Directory ${CONTEXT_DIR}
${ctx1} = Set Variable all_reject1_${UNIQUE_ID}
${ctx2} = Set Variable all_reject2_${UNIQUE_ID}
# Create contexts
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx1}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx2}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
# Delete all with confirmation rejected
${result} = Run Process python -m cleveragents context delete
... --all
... --context-dir ${CONTEXT_DIR}
... stdin=n\n
Should Be Equal As Integers ${result.rc} 0
Directory Should Exist ${CONTEXT_DIR}/${ctx1}
Directory Should Exist ${CONTEXT_DIR}/${ctx2}
Should Contain ${result.stdout} cancelled
Test Error When Both Name And All Provided
[Documentation] Test error when both NAME and --all are provided
${result} = Run Process python -m cleveragents context delete
... test_context
... --all
... --context-dir ${CONTEXT_DIR}
Should Not Be Equal As Integers ${result.rc} 0
Should Contain Any ${result.stderr} ${result.stdout} Cannot specify NAME when using --all
Test Error When Neither Name Nor All Provided
[Documentation] Test error when neither NAME nor --all is provided
${result} = Run Process python -m cleveragents context delete
... --context-dir ${CONTEXT_DIR}
Should Not Be Equal As Integers ${result.rc} 0
Should Contain Any ${result.stderr} ${result.stdout} Must specify NAME or use --all
Test Delete All When No Contexts Exist
[Documentation] Test delete all when directory is empty
# Ensure directory is empty
Empty Directory ${CONTEXT_DIR}
${result} = Run Process python -m cleveragents context delete
... --all
... --yes
... --context-dir ${CONTEXT_DIR}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} No contexts found
Test Delete Non Existent Context
[Documentation] Test deleting a context that doesn't exist
${result} = Run Process python -m cleveragents context delete
... non_existent_context_${UNIQUE_ID}
... --yes
... --context-dir ${CONTEXT_DIR}
Should Not Be Equal As Integers ${result.rc} 0
Should Contain Any ${result.stderr} ${result.stdout} does not exist
Test Delete All Shows Context List Before Deletion
[Documentation] Test that --all shows context list before confirmation
[Setup] Empty Directory ${CONTEXT_DIR}
${ctx1} = Set Variable list_ctx1_${UNIQUE_ID}
${ctx2} = Set Variable list_ctx2_${UNIQUE_ID}
${ctx3} = Set Variable list_ctx3_${UNIQUE_ID}
# Create contexts
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx1}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx2}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
Run Process python -m cleveragents actor run
... -c ${SIMPLE_CONFIG}
... --context ${ctx3}
... --context-dir ${CONTEXT_DIR}
... --unsafe
... --allow-rxpy-in-run-mode
... -p "test"
# Delete all with confirmation to see list
${result} = Run Process python -m cleveragents context delete
... --all
... --context-dir ${CONTEXT_DIR}
... stdin=n\n
Should Contain ${result.stdout} Found 3 context
Should Contain ${result.stdout} ${ctx1}
Should Contain ${result.stdout} ${ctx2}
Should Contain ${result.stdout} ${ctx3}
*** Keywords ***
Setup Test Environment
${timestamp} = Get Current Date result_format=%Y%m%d_%H%M%S
${random} = Evaluate random.randint(1000, 9999) modules=random
Set Suite Variable ${UNIQUE_ID} ${timestamp}_${random}
Set Suite Variable ${TEMP} ${TEMPDIR}/ca_delete_test_${UNIQUE_ID}
Set Suite Variable ${CONTEXT_DIR} ${TEMP}/contexts
Create Directory ${TEMP}
Create Directory ${CONTEXT_DIR}
Cleanup Test Environment
Run Keyword And Ignore Error Remove Directory ${TEMP} recursive=True
Should Contain Any
[Arguments] ${text1} ${text2} ${expected}
${combined} = Set Variable ${text1}${text2}
Should Contain ${combined} ${expected}