bdc2ccd6a3
This PR implements the Invariant data model and database schema for the v3.2.0 milestone. The Invariant feature enables the system to define, store, and manage invariant rules that can be evaluated against system state. - Alembic migration m3_001_invariants_table creates the invariants table with columns: id (UUID), description (text), created_at (timestamp), is_active (bool, default True), with index on is_active for efficiency - SQLAlchemy ORM InvariantModel in cleveragents.infrastructure.database.models.InvariantModel - M3 merge migration to resolve Alembic head conflict - BDD Behave scenarios (10 test cases) in features/invariant_model.feature - Robot Framework integration tests in robot/invariant_model.robot - Updated CHANGELOG.md and CONTRIBUTORS.md - Restored status-check CI aggregation job ISSUES CLOSED: #8524
64 lines
3.5 KiB
Plaintext
64 lines
3.5 KiB
Plaintext
*** Settings ***
|
|
Documentation Smoke tests for Invariant data model persistence contract
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment With Database Isolation
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${HELPER_SCRIPT} robot/helper_invariant_model.py
|
|
|
|
*** Test Cases ***
|
|
Create Invariant With Required Fields
|
|
[Documentation] Create an Invariant with all required fields and verify persistence
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} create_invariant cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=create_invariant failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-create-ok
|
|
|
|
Is Active Defaults To True
|
|
[Documentation] Verify that is_active defaults to True on a new Invariant
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} default_is_active cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=default_is_active failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-default-active-ok
|
|
|
|
Created At Is Populated
|
|
[Documentation] Verify that created_at is auto-populated on insert
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} created_at cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=created_at failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-created-at-ok
|
|
|
|
Id Is UUID
|
|
[Documentation] Verify that the Invariant id is a valid UUID string
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} uuid_id cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=uuid_id failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-uuid-ok
|
|
|
|
Query Active Invariants
|
|
[Documentation] Query Invariants filtered by is_active=True
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} query_active cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=query_active failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-query-active-ok
|
|
|
|
Query Inactive Invariants
|
|
[Documentation] Query Invariants filtered by is_active=False
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} query_inactive cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=query_inactive failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-query-inactive-ok
|
|
|
|
Deactivate Invariant
|
|
[Documentation] Set is_active to False on an existing Invariant
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} deactivate cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=deactivate failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-deactivate-ok
|
|
|
|
Table Exists After Migration
|
|
[Documentation] Verify the invariants table exists after schema creation
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} table_exists cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=table_exists failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-table-ok
|
|
|
|
Index On Is Active Exists
|
|
[Documentation] Verify the index on is_active exists after schema creation
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} index_exists cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0 msg=index_exists failed: ${result.stderr}
|
|
Should Contain ${result.stdout} invariant-index-ok
|