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

chore: make statemachine cw events test nonblocking #3196

Merged
merged 3 commits into from
Jun 1, 2023

Conversation

aaythapa
Copy link
Contributor

@aaythapa aaythapa commented Jun 1, 2023

Issue #, if available

Description of changes

These tests blocked the pipeline; added equivalent transform tests and marking as non-blocking since we've already tested it.

The integration tests only check that the right resources are made and that the properties are transformed as expected. This can be verified through the transform tests.

# checking if the name, description and state properties are correct
self.assertEqual(cw_rule_result["Name"], schedule_name)
self.assertEqual(cw_rule_result["Description"], "test schedule")
self.assertEqual(cw_rule_result["State"], "DISABLED")
self.assertEqual(cw_rule_result["ScheduleExpression"], "rate(1 minute)")
# checking if the role used by the event rule to trigger the state machine execution is correct
start_execution_policy = get_policy_statements(
event_role_name, "MyStateMachineCWScheduleRoleStartExecutionPolicy", self.client_provider.iam_client
)
self.assertEqual(len(start_execution_policy), 1, "Only one statement must be in Start Execution policy")
start_execution_policy_statement = start_execution_policy[0]
self.assertTrue(type(start_execution_policy_statement["Action"]) != list)
policy_action = start_execution_policy_statement["Action"]
self.assertEqual(
policy_action,
"states:StartExecution",
"Action referenced in event role policy must be 'states:StartExecution'",
)
self.assertTrue(type(start_execution_policy_statement["Resource"]) != list)
referenced_state_machine_arn = start_execution_policy_statement["Resource"]
self.assertEqual(
referenced_state_machine_arn,
state_machine_arn,
"State machine referenced in event role policy is incorrect",
)

Description of how you validated changes

Ensured new transform tests are same as the integration ones and that the output is expected.

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be
added to sam init through aws/aws-sam-cli-app-templates.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aaythapa aaythapa marked this pull request as ready for review June 1, 2023 16:58
@aaythapa aaythapa requested a review from a team as a code owner June 1, 2023 16:58
@aaythapa aaythapa merged commit 1737834 into aws:develop Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants