Files
cleveragents-core/tests/features/stream_templates_coverage.feature

193 lines
8.9 KiB
Gherkin

Feature: Stream Templates Module Coverage
As a developer
I want to test all functionality in the stream templates module
So that we achieve 90%+ code coverage for the stream_templates.py file
Background:
Given I have a clean test environment for stream templates
Scenario: Test StreamTemplate instantiate - basic functionality
Given I have a stream template with basic definition
And I have valid template parameters
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then the stream definition should be created correctly
And the parameters section should be removed
And template variables should be applied
Scenario: Test StreamTemplate instantiate - with parameters section
Given I have a stream template with parameters in definition
And I have valid template parameters
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then the stream definition should be created correctly
And the parameters section should be removed from definition
Scenario: Test StreamTemplate instantiate - with operators processing
Given I have a stream template with operators in definition
And I have valid template parameters
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then the stream definition should be created correctly
And operators should be processed for references
Scenario: Test StreamTemplate instantiate - adding name when not present
Given I have a stream template without name in definition
And I have valid template parameters
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then the stream definition should be created correctly
And the template name should be added to definition
Scenario: Test StreamTemplate instantiate - name already present
Given I have a stream template with name in definition
And I have valid template parameters
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then the stream definition should be created correctly
And the existing name should be preserved
Scenario: Test _process_operators - with None operator (conditionally excluded)
Given I have a stream template instance
And I have operators list with None operator
And I have template parameters
And I have an instantiation context
When I process the operators
Then the None operator should be skipped
And processed operators should not contain None
Scenario: Test _process_operators - with parameterized operator type
Given I have a stream template instance
And I have operators list with parameterized type
And I have template parameters with operator type
And I have an instantiation context
When I process the operators
Then the operator type should be replaced with parameter value
Scenario: Test _process_operators - processor with graph_execute type
Given I have a stream template instance
And I have operators list with processor graph_execute reference
And I have template parameters
And I have an instantiation context
When I process the operators
Then the operator should be converted to graph_execute type
And the processor params should be applied
Scenario: Test _process_operators - processor with agent type
Given I have a stream template instance
And I have operators list with processor agent reference
And I have template parameters
And I have an instantiation context
When I process the operators
Then the operator should be converted to map type
And the agent name should be applied
Scenario: Test _process_operators - map operator with agent parameter reference
Given I have a stream template instance
And I have operators list with map operator having agent parameter reference
And I have template parameters with agent name
And I have an instantiation context
When I process the operators
Then the agent reference should be replaced with parameter value
Scenario: Test _process_operators - map operator with agent component reference (successful)
Given I have a stream template instance
And I have operators list with map operator having agent component reference
And I have template parameters
And I have an instantiation context with resolvable agent reference
When I process the operators
Then the agent reference should be resolved successfully
And agent_config should be added to operator params
Scenario: Test _process_operators - map operator with agent component reference (failed)
Given I have a stream template instance
And I have operators list with map operator having agent component reference
And I have template parameters
And I have an instantiation context with unresolvable agent reference
When I process the operators
Then the agent reference resolution should fail silently
And the original agent reference should be preserved
Scenario: Test _process_operators - graph_execute operator with graph parameter reference
Given I have a stream template instance
And I have operators list with graph_execute operator having graph parameter reference
And I have template parameters with graph name
And I have an instantiation context
When I process the operators
Then the graph reference should be replaced with parameter value
Scenario: Test _process_operators - graph_execute operator with graph component reference (successful)
Given I have a stream template instance
And I have operators list with graph_execute operator having graph component reference
And I have template parameters
And I have an instantiation context with resolvable graph reference
When I process the operators
Then the graph reference should be resolved successfully
And graph_config should be added to operator params
Scenario: Test _process_operators - graph_execute operator with graph component reference (failed)
Given I have a stream template instance
And I have operators list with graph_execute operator having graph component reference
And I have template parameters
And I have an instantiation context with unresolvable graph reference
When I process the operators
Then the graph reference resolution should fail silently
And the original graph reference should be preserved
Scenario: Test _process_operators - mixed operators complex scenario
Given I have a stream template instance
And I have operators list with mixed operator types
And I have comprehensive template parameters
And I have an instantiation context with mixed references
When I process the operators
Then all operators should be processed correctly
And references should be resolved appropriately
And processed operators should be returned
Scenario: Test _process_operators - empty operators list
Given I have a stream template instance
And I have empty operators list
And I have template parameters
And I have an instantiation context
When I process the operators
Then an empty processed operators list should be returned
Scenario: Test StreamTemplate logging functionality
Given I have a stream template instance
And I have operators list with resolvable references
And I have template parameters
And I have an instantiation context with resolvable references
When I process the operators
Then debug logging should be triggered for successful resolutions
Scenario: Test parameter validation in instantiate
Given I have a stream template with parameter definitions
And I have template parameters requiring validation
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then parameters should be validated correctly
And the stream definition should use validated parameters
Scenario: Test deep copy behavior in instantiate
Given I have a stream template with mutable definition
And I have valid template parameters
And I have a template registry for stream templates
And I have an instantiation context
When I instantiate the stream template
Then the original definition should not be modified
And the returned definition should be a deep copy
Scenario: Test error handling in _process_operators - exception during resolution
Given I have a stream template instance
And I have operators list with agent component reference
And I have template parameters
And I have an instantiation context that throws exception during resolution
When I process the operators
Then the exception should be caught and handled silently
And processing should continue for remaining operators