8f986c1e31
Additional BDD scenarios covering registry resolver errors, cache TTL expiry, runtime dispatch normalization, template base edge cases, validation actor coverage gaps, and YAML Jinja loader deferred rendering.
272 lines
14 KiB
Gherkin
272 lines
14 KiB
Gherkin
Feature: YAMLJinjaLoader and TemplateAwareYAMLParser Template Processing Pipeline
|
|
As a developer
|
|
I want YAMLJinjaLoader to load and render YAML with inline and block templates, and TemplateAwareYAMLParser to parse with template extraction
|
|
So that the full template processing pipeline from file to configuration works with both block and inline Jinja2 templates
|
|
|
|
Background:
|
|
Given the yaml jinja loader system is initialized
|
|
And I have a clean test environment for yaml jinja processing
|
|
|
|
@yaml-jinja-loader-core
|
|
Scenario: YAMLJinjaLoader instance creation and initialization
|
|
When I create a YAMLJinjaLoader instance
|
|
Then the yaml jinja loader should be properly initialized
|
|
And the yaml jinja loader environment should be configured with correct settings
|
|
|
|
@yaml-jinja-loader-core
|
|
Scenario: Load YAML string content without any templates
|
|
Given I have yaml content without jinja templates
|
|
When I load the yaml content using yaml jinja loader
|
|
Then the content should be parsed as normal yaml
|
|
And no jinja template processing should occur
|
|
|
|
@yaml-jinja-loader-core
|
|
Scenario: Load YAML string with inline templates and rendering context
|
|
Given I have yaml content with inline jinja templates
|
|
And I have a rendering context dictionary
|
|
When I load the yaml content with the rendering context
|
|
Then the inline templates should be rendered using the context
|
|
And the result should contain the rendered template values
|
|
|
|
@yaml-jinja-loader-core
|
|
Scenario: Load YAML string with inline templates but no context
|
|
Given I have yaml content with inline jinja templates
|
|
When I load the yaml content without any rendering context
|
|
Then template rendering should be deferred for later processing
|
|
And template markers should be preserved in the parsed result
|
|
|
|
@yaml-jinja-loader-core
|
|
Scenario: Load YAML file with templates and context from filesystem
|
|
Given I have a yaml file containing jinja templates
|
|
And I have a rendering context dictionary
|
|
When I load the yaml file using yaml jinja loader with context
|
|
Then the file should be read and templates rendered with context
|
|
And the result should match expected rendered output
|
|
|
|
@yaml-jinja-loader-core
|
|
Scenario: Load plain YAML file without any templates from filesystem
|
|
Given I have a plain yaml file without jinja templates
|
|
When I load the plain yaml file using yaml jinja loader
|
|
Then the plain file should be parsed normally without template processing
|
|
And the result should match the original file content
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Render and parse YAML with complex template expressions
|
|
Given I have yaml content with complex jinja template expressions
|
|
And I have a comprehensive rendering context with variables and functions
|
|
When I perform render and parse operation on the content
|
|
Then all complex template expressions should be properly evaluated
|
|
And the result should contain all expected rendered values
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Defer template rendering while preserving template structure
|
|
Given I have yaml content with block level jinja templates
|
|
When I perform defer template rendering operation
|
|
Then template sections should be protected during yaml parsing
|
|
And template markers should be stored in the parsing result
|
|
And the original template content should be preserved for later use
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Protect template sections with placeholder replacement
|
|
Given I have yaml content with mixed template types for protection
|
|
When I perform protect template sections operation
|
|
Then block level templates should be replaced with unique placeholders
|
|
And inline template expressions should be replaced with unique placeholders
|
|
And the protected content should remain valid parseable yaml
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Protect block templates like for loops and conditionals
|
|
Given I have yaml content with for loops and conditional jinja blocks
|
|
When I perform protect template sections operation
|
|
Then block level templates should be identified and processed correctly
|
|
And placeholders should maintain the original yaml document structure
|
|
And template content should be stored with unique identifier keys
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Protect inline template expressions in yaml values
|
|
Given I have yaml content with inline jinja template expressions in values
|
|
When I perform protect template sections operation
|
|
Then inline template expressions should be detected in yaml values
|
|
And yaml key value pair structure should be preserved during protection
|
|
And template expressions should be stored separately with unique identifiers
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Restore template sections after yaml parsing is complete
|
|
Given I have parsed yaml data containing template placeholder markers
|
|
And I have the original template sections mapping dictionary
|
|
When I perform restore template sections operation
|
|
Then template placeholder markers should be replaced with original template content
|
|
And block level templates should be marked with appropriate template indicators
|
|
And inline template expressions should be marked with appropriate template indicators
|
|
|
|
@yaml-jinja-loader-advanced
|
|
Scenario: Restore nested template structures recursively through data
|
|
Given I have nested yaml data structures containing template markers
|
|
And I have template section mappings for all placeholder markers
|
|
When I perform recursive restore template sections operation
|
|
Then all nested data structures should be processed correctly
|
|
And template content should be restored at every nesting level
|
|
And non template data should remain completely unchanged
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: TemplateAwareYAMLParser instance creation and initialization
|
|
When I create a TemplateAwareYAMLParser instance
|
|
Then the template aware parser should be properly initialized
|
|
And it should contain a properly configured YAMLJinjaLoader instance
|
|
And the parser logger should be configured correctly
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: Parse yaml file using TemplateAwareYAMLParser interface
|
|
Given I have a yaml file with jinja templates for parser testing
|
|
And I have a rendering context for parser operations
|
|
When I parse the yaml file using TemplateAwareYAMLParser
|
|
Then the file should be processed by the underlying yaml jinja loader
|
|
And the parser result should match direct yaml jinja loader usage
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: Parse yaml string using TemplateAwareYAMLParser interface
|
|
Given I have yaml string content with jinja templates for parser testing
|
|
And I have a rendering context for parser operations
|
|
When I parse the yaml string using TemplateAwareYAMLParser
|
|
Then the string content should be processed by the underlying yaml jinja loader
|
|
And the parser result should match direct yaml jinja loader usage
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: Extract raw template definitions from configuration data
|
|
Given I have configuration data with various template definition types
|
|
When I extract raw templates from the configuration using parser
|
|
Then templates should be properly categorized by their type
|
|
And agent template definitions should be correctly identified
|
|
And graph template definitions should be correctly identified
|
|
And stream template definitions should be correctly identified
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: Extract only templates with template markers from configuration
|
|
Given I have configuration data containing template markers and regular data
|
|
When I extract raw templates using the parser
|
|
Then only configuration definitions with template markers should be extracted
|
|
And template content should be properly converted to yaml string format
|
|
And regular non template definitions should be completely ignored
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: Detect template markers in various data structure types
|
|
Given I have various data structures with and without template marker indicators
|
|
When I check for template markers using the parser
|
|
Then block level template markers should be properly detected
|
|
And inline template value markers should be properly detected
|
|
And nested template markers in complex structures should be properly detected
|
|
And plain data structures should not be incorrectly flagged as containing templates
|
|
|
|
@yaml-jinja-loader-parser
|
|
Scenario: Convert data structures to yaml string format representation
|
|
Given I have various types of data structures for yaml conversion
|
|
When I convert the data structures to yaml strings using parser
|
|
Then the yaml output should be in valid yaml format
|
|
And the original data structure should be completely preserved
|
|
And the yaml content should be human readable and well formatted
|
|
|
|
@yaml-jinja-loader-errors
|
|
Scenario: Handle template rendering errors with invalid jinja syntax
|
|
Given I have yaml content with invalid jinja template syntax
|
|
And I have a rendering context for error testing
|
|
When I attempt to render and parse the invalid content
|
|
Then a template rendering error should be properly raised
|
|
And the error should be logged with appropriate error information
|
|
And the original underlying exception should be preserved and accessible
|
|
|
|
@yaml-jinja-loader-errors
|
|
Scenario: Handle yaml parsing errors in protected content scenarios
|
|
Given I have content that becomes invalid yaml after template protection
|
|
When I attempt to defer template rendering on the invalid content
|
|
Then a yaml parsing error should be properly raised
|
|
And the error should be logged with detailed debug information
|
|
And the protected content should be included in debugging logs
|
|
|
|
@yaml-jinja-loader-errors
|
|
Scenario: Handle file system errors when loading yaml files
|
|
Given I have a non existent yaml file path for error testing
|
|
When I attempt to load the non existent yaml file
|
|
Then a file not found error should be properly raised
|
|
And the file system error should be handled appropriately by the loader
|
|
|
|
@yaml-jinja-loader-utilities
|
|
Scenario: Load yaml with built in utility functions available in context
|
|
Given I have yaml content using various built in utility functions
|
|
When I load the yaml content without providing explicit context
|
|
Then built in utility functions should be automatically available in context
|
|
And range len str int float bool functions should work correctly
|
|
And min max enumerate zip list dict functions should work correctly
|
|
|
|
@yaml-jinja-loader-utilities
|
|
Scenario: Override built in utilities with custom context values
|
|
Given I have yaml content using utility functions that can be overridden
|
|
And I have a custom rendering context that overrides some utility functions
|
|
When I load the yaml content with the custom overriding context
|
|
Then custom context values should take precedence over built in utilities
|
|
And remaining non overridden utilities should still be available and functional
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Process completely empty yaml content gracefully
|
|
Given I have completely empty yaml content for edge case testing
|
|
When I load the empty yaml content using yaml jinja loader
|
|
Then the empty content should be handled gracefully without errors
|
|
And no exceptions should occur during empty content processing
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Process yaml content containing only comment lines
|
|
Given I have yaml content containing only comment lines
|
|
When I load the comment only yaml content using yaml jinja loader
|
|
Then the comment only content should be handled appropriately
|
|
And the parsing result should be valid for comment only content
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Process yaml with both block and inline template types mixed
|
|
Given I have yaml content with both block and inline jinja template types
|
|
When I defer template rendering on the mixed template content
|
|
Then both block and inline template types should be properly protected
|
|
And both template types should be correctly restored after processing
|
|
And the final document structure should be coherent and well formed
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Process deeply nested yaml structures with templates at multiple levels
|
|
Given I have deeply nested yaml containing jinja templates at multiple nesting levels
|
|
When I process the deeply nested yaml content using yaml jinja loader
|
|
Then all nesting levels should be handled correctly during processing
|
|
And templates at each nesting level should be processed appropriately
|
|
And the nested document structure should be completely preserved
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Process templates containing special yaml characters and syntax
|
|
Given I have jinja templates containing special yaml characters and syntax elements
|
|
When I protect and restore template sections containing special characters
|
|
Then special yaml characters should be handled correctly during processing
|
|
And yaml document structure should remain valid throughout processing
|
|
And template content should be preserved exactly without modification
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Load string without templates that parses as list raises ValueError
|
|
Given the yaml jinja loader system is initialized
|
|
And I have a clean test environment for yaml jinja processing
|
|
When I load yaml content that parses as a list using yaml jinja loader
|
|
Then a ValueError should be raised for non-dict yaml result
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Render template that results in non-dict raises ValueError
|
|
Given the yaml jinja loader system is initialized
|
|
And I have a clean test environment for yaml jinja processing
|
|
When I render a template that yields non-dict result with context
|
|
Then a ValueError should be raised for non-dict rendered result
|
|
|
|
@yaml-jinja-loader-edge
|
|
Scenario: Protect template sections with unknown tag type
|
|
Given the yaml jinja loader system is initialized
|
|
And I have a clean test environment for yaml jinja processing
|
|
When I protect template sections with an unknown tag
|
|
Then the unknown tag should be replaced with SKIP
|
|
|
|
Scenario: YAMLJinjaLoader defers rendering when no context is provided
|
|
Given the yaml jinja loader system is initialized
|
|
And I have a clean test environment for yaml jinja processing
|
|
When I load YAML content with Jinja2 templates without providing context
|
|
Then the result should contain deferred template markers
|