Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4.5k
[SFN][TestState] Make roleArn optional#13459
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e32a23a2d44c9a3f97e0d277550098dd17dce57c829760b97File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -162,6 +162,7 @@ | ||
| normalise_max_results, | ||
| ) | ||
| from localstack.state import StateVisitor | ||
| from localstack.utils.aws import arns | ||
| from localstack.utils.aws.arns import ( | ||
| ARN_PARTITION_REGEX, | ||
| stepfunctions_activity_arn, | ||
| @@ -1543,10 +1544,27 @@ def test_state( | ||
| arn = stepfunctions_state_machine_arn( | ||
| name=name, account_id=context.account_id, region_name=context.region | ||
| ) | ||
| role_arn = request.get("roleArn") | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Do you know if the ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I plan to investigate it later, also noticed the lack of validation. | ||
| if role_arn is None: | ||
| TestStateStaticAnalyser.validate_role_arn_required( | ||
| mock_input=mock_input, definition=definition, state_name=state_name | ||
| ) | ||
| # HACK: Added dummy role ARN because it is a required field in Execution. | ||
| # To allow optional roleArn for the test state but preserve the mandatory one for regular executions | ||
| # we likely need to remove inheritance TestStateExecution(Execution) in favor of composition. | ||
| # TestState execution starts to have too many simplifications compared to a regular execution | ||
| # which renders the inheritance mechanism harmful. | ||
| # TODO make role_arn optional in TestStateExecution | ||
| role_arn = arns.iam_role_arn( | ||
| role_name=f"RoleFor-{name}", | ||
| account_id=context.account_id, | ||
| region_name=context.region, | ||
| ) | ||
| state_machine = TestStateMachine( | ||
| name=name, | ||
| arn=arn, | ||
| role_arn=role_arn, | ||
| definition=request["definition"], | ||
| ) | ||
| @@ -1561,7 +1579,7 @@ def test_state( | ||
| execution = TestStateExecution( | ||
| name=exec_name, | ||
| role_arn=role_arn, | ||
| exec_arn=exec_arn, | ||
| account_id=context.account_id, | ||
| region_name=context.region, | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.