fix(infra): ensure E2E suite setup initializes database before CLI commands #1177
@@ -24,6 +24,7 @@ E2E Suite Setup
|
||||
Log Setting up E2E test environment
|
||||
${safe_suite}= Replace String ${SUITE NAME} ${SPACE} _
|
||||
${safe_suite}= Replace String ${safe_suite} . _
|
||||
${safe_suite}= Replace String Using Regexp ${safe_suite} [^A-Za-z0-9_-] _
|
||||
${home}= Set Variable ${E2E_TEMP_ROOT}${/}${safe_suite}
|
||||
${rm_status} ${rm_msg}= Run Keyword And Ignore Error Remove Directory ${home} recursive=True
|
||||
IF '${rm_status}' == 'FAIL'
|
||||
@@ -38,6 +39,13 @@ E2E Suite Setup
|
||||
# Get the actual Python executable being used
|
||||
${python_exec}= Evaluate sys.executable sys
|
||||
Set Suite Variable ${PYTHON} ${python_exec}
|
||||
# Explicitly initialize the workspace once per suite so DB-dependent
|
||||
# commands do not need per-test init workarounds.
|
||||
${init}= Run CleverAgents Command init --yes --force --path ${SUITE_HOME}
|
||||
Should Be Equal As Integers ${init.rc} 0
|
||||
# Post-init sanity: ensure init produced the expected workspace state.
|
||||
Directory Should Exist ${SUITE_HOME}${/}.cleveragents
|
||||
File Should Exist ${SUITE_HOME}${/}.cleveragents${/}db.sqlite
|
||||
|
||||
E2E Suite Teardown
|
||||
[Documentation] Clean up the E2E test environment.
|
||||
|
||||
@@ -10,7 +10,6 @@ Suite Teardown E2E Suite Teardown
|
||||
Session Create Then List Shows Session
|
||||
[Documentation] Create a session and verify it appears in session list.
|
||||
[Tags] E2E tdd_issue tdd_issue_1141
|
||||
Run CleverAgents Command init --force --yes
|
||||
${r1}= Run CleverAgents Command session list --format json
|
||||
Should Contain ${r1.stdout} "total": 0
|
||||
Run CleverAgents Command session create --format plain
|
||||
|
||||
@@ -13,12 +13,8 @@ Force Tags E2E
|
||||
|
||||
*** Keywords ***
|
||||
M6 Suite Setup
|
||||
[Documentation] E2E Suite Setup plus database initialisation for session tests.
|
||||
[Documentation] E2E Suite Setup plus unique run suffix and action registration.
|
||||
E2E Suite Setup
|
||||
# Initialise the database so session/config commands work in all tests.
|
||||
# Use --force because the workspace may already contain an initialised project.
|
||||
${init}= Run CleverAgents Command init --force --yes
|
||||
Should Be Equal As Integers ${init.rc} 0
|
||||
# Generate a unique suffix for resource/project names to avoid UNIQUE
|
||||
# constraint collisions on repeated E2E runs against the same database.
|
||||
# uuid4 provides ~4 billion possibilities vs randint's 9000 for parallel CI safety.
|
||||
|
||||
@@ -21,10 +21,8 @@ ${RESOURCE_TYPE_NAME} local/wf05-postgres-db
|
||||
|
||||
*** Keywords ***
|
||||
WF05 Suite Setup
|
||||
[Documentation] E2E Suite Setup plus database init and dynamic actor selection.
|
||||
[Documentation] E2E Suite Setup plus dynamic actor selection.
|
||||
E2E Suite Setup
|
||||
${init}= Run CleverAgents Command init --force --yes
|
||||
Should Be Equal As Integers ${init.rc} 0
|
||||
# Generate unique suffix for resource/project names to avoid UNIQUE
|
||||
# constraint collisions on repeated E2E runs against the same database.
|
||||
${suffix}= Evaluate __import__('uuid').uuid4().hex[:12]
|
||||
|
||||
@@ -29,11 +29,6 @@ WF07 E2E CI Profile Configuration
|
||||
... and log level per specification Step 1.
|
||||
[Tags] E2E
|
||||
[Teardown] Log CI Profile Configuration teardown complete
|
||||
# Initialize the CleverAgents data directory and database
|
||||
# expected_rc=None: init may report the CWD is already initialized; this
|
||||
# is harmless because CLEVERAGENTS_HOME is set to a fresh temp dir by
|
||||
# Suite Setup.
|
||||
Run CleverAgents Command init --yes expected_rc=None
|
||||
# Automation profile
|
||||
Run CleverAgents Command config set core.automation-profile ci
|
||||
${get_profile}= Run CleverAgents Command config get core.automation-profile --format plain
|
||||
@@ -280,11 +275,9 @@ WF07 E2E JSON Output Verification
|
||||
|
||||
*** Keywords ***
|
||||
WF07 Suite Setup
|
||||
[Documentation] E2E Suite Setup plus database initialisation.
|
||||
[Documentation] Delegate to shared E2E Suite Setup (includes centralized
|
||||
... database initialization for DB-dependent CLI commands).
|
||||
E2E Suite Setup
|
||||
# Initialise the database so config/resource/project commands work.
|
||||
${init}= Run CleverAgents Command init --force --yes
|
||||
Should Be Equal As Integers ${init.rc} 0
|
||||
|
||||
Create Temp Git Repo With Issues
|
||||
[Documentation] Create a temporary git repo containing Python files with
|
||||
|
||||
@@ -16,11 +16,8 @@ Force Tags E2E
|
||||
|
||||
*** Keywords ***
|
||||
WF14 Suite Setup
|
||||
[Documentation] E2E Suite Setup plus database initialisation for WF14 tests.
|
||||
[Documentation] E2E Suite Setup plus unique run suffix generation.
|
||||
E2E Suite Setup
|
||||
# Initialise the database so action/actor/plan commands work in all tests.
|
||||
${init}= Run CleverAgents Command init --yes
|
||||
Should Be Equal As Integers ${init.rc} 0
|
||||
# Generate a unique suffix for entity names to avoid UNIQUE
|
||||
# constraint collisions on repeated E2E runs or parallel CI.
|
||||
${suffix}= Evaluate __import__('uuid').uuid4().hex[:12]
|
||||
|
||||
Reference in New Issue
Block a user