-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[SFN][TestState] Add validations for mock presence depending on state type #13457
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
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 21m 58s ⏱️ - 1h 43m 16s Results for commit 1d472cb. ± Comparison against base commit 84bdd4a. This pull request removes 3401 and adds 8 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 39m 30s ⏱️ Results for commit 1d472cb. ♻️ This comment has been updated with latest results. |
66b9c53 to
11a0e42
Compare
gregfurman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| if mock_input is None and isinstance(test_state, (StateMap, StateParallel)): | ||
| # This is a literal message when a Map or Parallel state is not accompanied by a mock in a test state request. | ||
| # The message is the same for both cases and is not parametrised anyhow. | ||
| raise InvalidDefinition( | ||
| "TestState API does not support Map or Parallel states. Supported state types include: [Task, Wait, Pass, Succeed, Fail, Choice]" | ||
| ) | ||
|
|
||
| if mock_input is not None and isinstance(test_state, (StatePass, StateFail, StateSucceed)): | ||
| raise ValidationException( | ||
| f"State type '{test_state.state_type.name}' is not supported when a mock is specified" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Would be nice to return early here if mock_input exists.
i.e
if mock_input:
return
if isinstance(test_state, (StateMap, StateParallel)):
raise InvalidDefinition(...)
# ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll be refactoring this code with the upcoming validations for mock contents, so this will change 👍
Motivation
Add validations for mock presence depending on state type.
Closes DRG-310
Changes
Add validations:
Tests
Related