b122ec7ed5
CI / lint (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 55s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 26s
CI / e2e_tests (pull_request) Successful in 3m38s
CI / integration_tests (pull_request) Successful in 6m42s
CI / unit_tests (pull_request) Successful in 8m19s
CI / docker (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 15m23s
CI / status-check (pull_request) Successful in 2s
Remove the local ${PYTHON} python (and python3) variable definitions from
the *** Variables *** sections of all affected robot files. These local
definitions were overriding the pabot-injected venv Python path passed via
--variable PYTHON:/path/to/venv/python, causing tests to use the system
Python (which lacks required packages like structlog, sqlalchemy, etc.)
instead of the nox venv Python.
The correct ${PYTHON} value is already set by Setup Test Environment in
common.resource via sys.executable, and pabot passes it via --variable.
The local fallback definitions are redundant and harmful in parallel runs.
Audit found 56 robot files with the pattern (more than the 9 originally
identified in the issue). All occurrences have been removed.
ISSUES CLOSED: #1309
122 lines
6.8 KiB
Plaintext
122 lines
6.8 KiB
Plaintext
*** Settings ***
|
|
Documentation Resource CLI Tree and Inspect Integration Tests
|
|
Library Process
|
|
Library OperatingSystem
|
|
|
|
*** Test Cases ***
|
|
Resource Tree Shows Root Resource
|
|
[Documentation] Run resource tree on a resource with no children
|
|
${script}= Catenate SEPARATOR=\n
|
|
... import json
|
|
... from datetime import datetime, UTC
|
|
... from sqlalchemy import create_engine, event
|
|
... from sqlalchemy.orm import sessionmaker
|
|
... from cleveragents.infrastructure.database.models import Base
|
|
... from cleveragents.application.services.resource_registry_service import ResourceRegistryService
|
|
... engine = create_engine("sqlite:///:memory:")
|
|
... @event.listens_for(engine, "connect")
|
|
... def _fk(conn, _): conn.cursor().execute("PRAGMA foreign_keys=ON")
|
|
... Base.metadata.create_all(engine)
|
|
... factory = sessionmaker(bind=engine, expire_on_commit=False)
|
|
... svc = ResourceRegistryService(session_factory=factory)
|
|
... svc.bootstrap_builtin_types()
|
|
... svc.register_resource(type_name="git-checkout", name="local/tree-test", location="/tmp/tt", properties={"path": "/tmp/tt"})
|
|
... tree = svc.get_resource_tree("local/tree-test")
|
|
... assert len(tree) == 1
|
|
... node = tree[0]
|
|
... assert node["resource"].name == "local/tree-test"
|
|
... assert node["children"] == []
|
|
... print("Resource tree root test passed")
|
|
${result}= Run Process ${PYTHON} -c ${script}
|
|
Should Be Equal As Integers ${result.rc} 0 Tree root test failed: ${result.stderr}
|
|
Should Contain ${result.stdout} Resource tree root test passed
|
|
|
|
Resource Inspect Shows Details
|
|
[Documentation] Inspect a resource and verify basic details
|
|
${script}= Catenate SEPARATOR=\n
|
|
... import json
|
|
... from datetime import datetime, UTC
|
|
... from sqlalchemy import create_engine, event
|
|
... from sqlalchemy.orm import sessionmaker
|
|
... from cleveragents.infrastructure.database.models import Base
|
|
... from cleveragents.application.services.resource_registry_service import ResourceRegistryService
|
|
... engine = create_engine("sqlite:///:memory:")
|
|
... @event.listens_for(engine, "connect")
|
|
... def _fk(conn, _): conn.cursor().execute("PRAGMA foreign_keys=ON")
|
|
... Base.metadata.create_all(engine)
|
|
... factory = sessionmaker(bind=engine, expire_on_commit=False)
|
|
... svc = ResourceRegistryService(session_factory=factory)
|
|
... svc.bootstrap_builtin_types()
|
|
... res = svc.register_resource(type_name="git-checkout", name="local/inspect-test", location="/tmp/it", properties={"path": "/tmp/it"})
|
|
... shown = svc.show_resource("local/inspect-test")
|
|
... assert shown.name == "local/inspect-test"
|
|
... assert shown.resource_type_name == "git-checkout"
|
|
... assert shown.location == "/tmp/it"
|
|
... print("Resource inspect test passed")
|
|
${result}= Run Process ${PYTHON} -c ${script}
|
|
Should Be Equal As Integers ${result.rc} 0 Inspect test failed: ${result.stderr}
|
|
Should Contain ${result.stdout} Resource inspect test passed
|
|
|
|
Link And Unlink Child Via Service
|
|
[Documentation] Link a child via service and then unlink it
|
|
${script}= Catenate SEPARATOR=\n
|
|
... import json
|
|
... from datetime import datetime, UTC
|
|
... from sqlalchemy import create_engine, event
|
|
... from sqlalchemy.orm import sessionmaker
|
|
... from cleveragents.infrastructure.database.models import Base
|
|
... from cleveragents.application.services.resource_registry_service import ResourceRegistryService
|
|
... engine = create_engine("sqlite:///:memory:")
|
|
... @event.listens_for(engine, "connect")
|
|
... def _fk(conn, _): conn.cursor().execute("PRAGMA foreign_keys=ON")
|
|
... Base.metadata.create_all(engine)
|
|
... factory = sessionmaker(bind=engine, expire_on_commit=False)
|
|
... svc = ResourceRegistryService(session_factory=factory)
|
|
... svc.bootstrap_builtin_types()
|
|
... svc.register_resource(type_name="git-checkout", name="local/link-p", location="/tmp/lp", properties={"path": "/tmp/lp"})
|
|
... svc.register_resource(type_name="fs-directory", name="local/link-c", location="/tmp/lc", properties={"path": "/tmp/lc"})
|
|
... svc.link_child("local/link-p", "local/link-c")
|
|
... children = svc.get_children("local/link-p")
|
|
... assert len(children) == 1
|
|
... assert children[0].name == "local/link-c"
|
|
... svc.unlink_child("local/link-p", "local/link-c")
|
|
... children = svc.get_children("local/link-p")
|
|
... assert len(children) == 0
|
|
... print("Link and unlink child passed")
|
|
${result}= Run Process ${PYTHON} -c ${script}
|
|
Should Be Equal As Integers ${result.rc} 0 Link/unlink test failed: ${result.stderr}
|
|
Should Contain ${result.stdout} Link and unlink child passed
|
|
|
|
Resource Tree With Children Shows Hierarchy
|
|
[Documentation] Resource tree with linked children shows hierarchy
|
|
${script}= Catenate SEPARATOR=\n
|
|
... import json
|
|
... from datetime import datetime, UTC
|
|
... from sqlalchemy import create_engine, event
|
|
... from sqlalchemy.orm import sessionmaker
|
|
... from cleveragents.infrastructure.database.models import Base
|
|
... from cleveragents.application.services.resource_registry_service import ResourceRegistryService
|
|
... engine = create_engine("sqlite:///:memory:")
|
|
... @event.listens_for(engine, "connect")
|
|
... def _fk(conn, _): conn.cursor().execute("PRAGMA foreign_keys=ON")
|
|
... Base.metadata.create_all(engine)
|
|
... factory = sessionmaker(bind=engine, expire_on_commit=False)
|
|
... svc = ResourceRegistryService(session_factory=factory)
|
|
... svc.bootstrap_builtin_types()
|
|
... svc.register_resource(type_name="git-checkout", name="local/tree-parent", location="/tmp/tp", properties={"path": "/tmp/tp"})
|
|
... svc.register_resource(type_name="fs-directory", name="local/tree-child", location="/tmp/tc", properties={"path": "/tmp/tc"})
|
|
... svc.link_child("local/tree-parent", "local/tree-child")
|
|
... tree = svc.get_resource_tree("local/tree-parent")
|
|
... assert len(tree) == 1
|
|
... root = tree[0]
|
|
... assert root["resource"].name == "local/tree-parent"
|
|
... assert len(root["children"]) == 1
|
|
... child_node = root["children"][0]
|
|
... assert child_node["resource"].name == "local/tree-child"
|
|
... print("Tree with children test passed")
|
|
${result}= Run Process ${PYTHON} -c ${script}
|
|
Should Be Equal As Integers ${result.rc} 0 Tree children test failed: ${result.stderr}
|
|
Should Contain ${result.stdout} Tree with children test passed
|
|
|
|
*** Keywords ***
|