Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat+fix(engine)!: Support enums and defaults in Action Templates #644

Merged
merged 33 commits into from
Dec 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3fb7eb9
Add tests
topher-lo Dec 19, 2024
fceab7a
Add more informative inline comments in tests
topher-lo Dec 19, 2024
3442d77
Test defaults logic in template actions
topher-lo Dec 20, 2024
32460bf
Add enum type to expectations
topher-lo Dec 20, 2024
ace09b1
fix missing arg in test
topher-lo Dec 20, 2024
3513263
Update verbosity of register logs
topher-lo Dec 21, 2024
29436ad
Update default / non default args tests
topher-lo Dec 21, 2024
e17e75e
feat: Use validated args in `run_template_action`
topher-lo Dec 21, 2024
b165b08
Replace `None` with `null` (reverved string) to represent null defaul…
topher-lo Dec 21, 2024
fc40087
Drop unused validate path in _run_action_direct
topher-lo Dec 21, 2024
9d5495e
Check RegistryValidationError raised
topher-lo Dec 21, 2024
e72fbff
return validated_args in BoundRegistryAction.validate_args with json …
topher-lo Dec 21, 2024
134794a
fix replace str | None with str | null in wazuh `run_rootcheck`
topher-lo Dec 21, 2024
4fc933f
fix int | null in _example_template_action
topher-lo Dec 21, 2024
1bb2bc8
Replace int | None with int | null in test_expectations schemas
topher-lo Dec 21, 2024
b924857
Revert null type
topher-lo Dec 21, 2024
112deb1
revert nulls
topher-lo Dec 21, 2024
a5a1194
revert null : None mapping
topher-lo Dec 21, 2024
794fe98
validate args in run action direct (udf)
topher-lo Dec 21, 2024
4e4ba4c
Apply suggestions from code review
topher-lo Dec 22, 2024
3e1d6aa
Updates
topher-lo Dec 22, 2024
80cc4b8
Support single quotes in enum
topher-lo Dec 22, 2024
d39f06f
Add Enum as prefix to enum class name
topher-lo Dec 22, 2024
7398642
refactor: Call TEMPLATE_ACTION_INPUTS var `validated_args`
topher-lo Dec 22, 2024
c9fa57c
Capture e representation for unexpected errors in action.validate_args
topher-lo Dec 22, 2024
b5d70ee
Drop RegistryValidationError from registry
topher-lo Dec 23, 2024
8091d72
Make RegistryValidationError serializable
topher-lo Dec 23, 2024
67bf6fe
Merge branch 'main' into feat/enum-action-templates
topher-lo Dec 23, 2024
a8e09fa
Fix expected enum class value with prefix
topher-lo Dec 23, 2024
402fe85
more test fixes
topher-lo Dec 23, 2024
15287bf
simplify enum validate schema param names
topher-lo Dec 23, 2024
b7373ce
Update models.py
topher-lo Dec 23, 2024
90f26c4
fix missing raise RegistryValidationError(
topher-lo Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check RegistryValidationError raised
topher-lo committed Dec 21, 2024
commit 9d5495ee64bc7b7296db8f8d1763b4cd261e25d6
7 changes: 3 additions & 4 deletions tests/unit/test_template_actions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
from pydantic import ValidationError
from tracecat_registry import RegistrySecret
from tracecat_registry import RegistrySecret, RegistryValidationError

from tracecat.executor import service
from tracecat.expressions.expectations import ExpectedField
@@ -194,7 +193,7 @@ async def test_template_action_run(test_args, expected_result, should_raise):

# Run the action
if should_raise:
with pytest.raises(ValidationError):
with pytest.raises(RegistryValidationError):
await service.run_template_action(
action=bound_action,
args=test_args,
@@ -287,7 +286,7 @@ async def test_enum_template_action(test_args, expected_result, should_raise):

# Run the action
if should_raise:
with pytest.raises(ValidationError):
with pytest.raises(RegistryValidationError):
await service.run_template_action(
action=bound_action,
args=test_args,