forked from cleveragents/cleveragents-core
103 lines
4.7 KiB
Gherkin
103 lines
4.7 KiB
Gherkin
@phase1 @domain @repository @tool_registry
|
|
Feature: Tool Registry Persistence
|
|
As a system operator managing tools and validations
|
|
I want the tool registry to reliably persist and retrieve entries
|
|
So that tools and validation attachments are durable and queryable
|
|
|
|
Background:
|
|
Given a clean tool registry database
|
|
And a tool repository backed by the database
|
|
And a validation attachment repository backed by the database
|
|
And a tool registry service with both repositories
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Register a tool
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@tool_register
|
|
Scenario: Register a tool and verify it persists
|
|
Given a valid tool config for "local/file-read" with source "builtin"
|
|
When the tool is registered through the service
|
|
Then the service should return a tool_id
|
|
And the tool "local/file-read" should be retrievable by name
|
|
And the retrieved tool should have source "builtin"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Update a tool
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@tool_update
|
|
Scenario: Update a tool config
|
|
Given a valid tool config for "local/updatable" with source "builtin"
|
|
And the tool has been registered through the service
|
|
When the tool "local/updatable" description is updated to "New desc"
|
|
Then the tool "local/updatable" should have description "New desc"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Remove a tool
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@tool_remove
|
|
Scenario: Remove a tool
|
|
Given a valid tool config for "local/removable" with source "builtin"
|
|
And the tool has been registered through the service
|
|
When the tool "local/removable" is removed
|
|
Then the tool "local/removable" should not exist
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# List with filter
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@tool_list
|
|
Scenario: List tools with type filter
|
|
Given a valid tool config for "local/list-tool" with source "builtin"
|
|
And the tool has been registered through the service
|
|
And a validation tool config for "local/list-val" with source "builtin"
|
|
And the tool has been registered through the service
|
|
When tools are listed with type filter "tool"
|
|
Then the registry tool list should include "local/list-tool"
|
|
And the registry tool list should exclude "local/list-val"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Attach validation to resource
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@validation_attach
|
|
Scenario: Attach validation to resource
|
|
Given a resource with id "01HGZ6FE0AQDYTR4BX00000099" exists in the database
|
|
When validation "local/my-check" is attached to resource "01HGZ6FE0AQDYTR4BX00000099" with mode "required"
|
|
Then the attachment should return a valid attachment_id
|
|
And the resource "01HGZ6FE0AQDYTR4BX00000099" should have 1 validation attachments
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Detach validation from resource
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@validation_detach
|
|
Scenario: Detach validation from resource
|
|
Given a resource with id "01HGZ6FE0AQDYTR4BX00000098" exists in the database
|
|
And validation "local/detach-check" is attached to resource "01HGZ6FE0AQDYTR4BX00000098"
|
|
When validation "local/detach-check" is detached from resource "01HGZ6FE0AQDYTR4BX00000098"
|
|
Then the resource "01HGZ6FE0AQDYTR4BX00000098" should have 0 validation attachments
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Error: invalid tool_type
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@tool_error @error_handling
|
|
Scenario: Reject invalid tool type
|
|
Given a tool config with invalid tool_type "unknown"
|
|
When the tool registration is attempted
|
|
Then a ValidationError should be raised mentioning "Invalid tool_type"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Error: duplicate tool name
|
|
# ---------------------------------------------------------------------------
|
|
|
|
@tool_error @error_handling
|
|
Scenario: Reject duplicate tool name
|
|
Given a valid tool config for "local/dup-tool" with source "builtin"
|
|
And the tool has been registered through the service
|
|
When a second tool with the same name "local/dup-tool" is registered
|
|
Then a DuplicateToolError should be raised mentioning "local/dup-tool"
|