Skip to content

Conversation

@tiurin
Copy link
Contributor

@tiurin tiurin commented Dec 3, 2025

Motivation

roleArn is now only required when tested state is Task and a mock is not provided.

Closes DRG-238.

Changes

Add validation for roleArn presence.
Add workaround for roleArn being not optional in Execution hierarchy.
Remove roleArn from tests where it is not needed - much faster execution agaisnt AWS with only necessary fields provided. Snapshot recording hasn't changed.

Tests

Related

Test passes just fine as roleArn became optional.
Also, test runs way faster against AWS now because the majority of time was spent in role creation.
Hack to check if basic test state scenario works well in LocalStack without a real role.
Pending comment about a hack and a validation for states where dummy role cannot be used.
When state is Task and mock is not supplied
Faster execution with only necessary fields provided. Snapshot recording hasn't changed.
@tiurin tiurin requested a review from gregfurman December 3, 2025 01:43
@tiurin tiurin added aws:stepfunctions AWS Step Functions semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Dec 3, 2025
sfn_snapshot.match("test_case_response", test_case_response)

@markers.aws.validated
def test_base_lambda_service_task_state_no_role_arn_validation(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test for the case when roleArn is actually needed.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Test Results - Preflight, Unit

22 889 tests  ±0   21 075 ✅ ±0   6m 57s ⏱️ +52s
     1 suites ±0    1 814 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 9760b97. ± Comparison against base commit 049201f.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   22m 32s ⏱️ - 1h 40m 51s
1 703 tests  - 3 400  1 614 ✅  - 3 097  89 💤  - 303  0 ❌ ±0 
1 705 runs   - 3 400  1 614 ✅  - 3 097  91 💤  - 303  0 ❌ ±0 

Results for commit 9760b97. ± Comparison against base commit 049201f.

This pull request removes 3401 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.stepfunctions.v2.test_state.test_test_state_scenarios.TestStateCaseScenarios ‑ test_base_lambda_service_task_state_no_role_arn_validation

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 22s ⏱️ ±0s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 9760b97. ± Comparison against base commit 049201f.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   39m 10s ⏱️
1 727 tests 1 639 ✅ 88 💤 0 ❌
1 733 runs  1 639 ✅ 94 💤 0 ❌

Results for commit 9760b97.

@tiurin tiurin added the review: merge when ready Signals to the reviewer that a PR can be merged if accepted label Dec 3, 2025
Copy link
Contributor

@gregfurman gregfurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to unblock us 👍

arn = stepfunctions_state_machine_arn(
name=name, account_id=context.account_id, region_name=context.region
)
role_arn = request.get("roleArn")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if the roleArn param requires any special validations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to investigate it later, also noticed the lack of validation.

@tiurin tiurin merged commit 84bdd4a into main Dec 3, 2025
63 checks passed
@tiurin tiurin deleted the sfn/feat/test-state-optional-role branch December 3, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws:stepfunctions AWS Step Functions docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes review: merge when ready Signals to the reviewer that a PR can be merged if accepted semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants