-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(stepfunctions): add waitForAssertions
to distributed-map assertions to wait for the expected resource state
#30286
Conversation
Signed-off-by: Francis <colifran@amazon.com>
waitForAssertion
to assertions to wait the expected responsewaitForAssertion
to assertions to wait for the expected response
waitForAssertion
to assertions to wait for the expected responsewaitForAssertion
to distributed-map assertions to wait for the expected response
waitForAssertion
to distributed-map assertions to wait for the expected responsewaitForAssertion
to distributed-map assertions to wait for the expected resource state
waitForAssertion
to distributed-map assertions to wait for the expected resource statewaitForAssertions
to distributed-map assertions to wait for the expected resource state
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 🚀
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…rtions to wait for the expected resource state (aws#30286) ### Reason for this change Two assertions made in `integ.distributed-map.ts` are waiting on a specific resource state. The following waits for a state machine to be `ACTIVE`: ```ts testCase.assertions .awsApiCall('StepFunctions', 'describeStateMachine', { stateMachineArn: stack.stateMachine.stateMachineArn, }) .expect(ExpectedResult.objectLike({ status: 'ACTIVE' })); ``` The following wait for the state machine execution to be `SUCCEEDED`: ```ts describe.expect(ExpectedResult.objectLike({ status: 'SUCCEEDED', })); ``` In the current format, the second assertion fails because the state machine execution is still running at the time the assertion is made. This causes the integ test to fail with the following error: ``` { "executionArn": "arn:aws:states:us-east-1:123456789012:execution:StateMachine2E01A3A5-OqZg4PaGWIUA:ecfc64d5-c20e-483b-a2ec-9ef8f82b2214", "input": "{}", "inputDetails": { ... }, "name": "ecfc64d5-c20e-483b-a2ec-9ef8f82b2214", "redriveCount": 0, "redriveStatus": "NOT_REDRIVABLE", "redriveStatusReason": "Execution is RUNNING and cannot be redriven", "startDate": {}, "stateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:StateMachine2E01A3A5-OqZg4PaGWIUA", !! Expected SUCCEEDED but received RUNNING "status": "RUNNING", "traceHeader": "Root=1-664c0401-4504db7463bcd92c490e52bc;Parent=5ea37aeb46708a96;Sampled=0" } ``` As a best practice, we should always ensure that assertions based on resource state have a `waitForAssertions` call to force the assertion to wait for the specific state to occur. ### Description of changes I added a `waitForAssertions` call to each assertion in this integ test that is waiting for a specific resource state. Each `waitForAssertions` call has the following waiter options: - A total timeout of 5 minutes, after which the assertion will fail. - A 10 second interval which will be used to check if the resource is in the expected state. ### Description of how you validated changes Re-ran the integ test and it succeeded. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…rtions to wait for the expected resource state (aws#30286) ### Reason for this change Two assertions made in `integ.distributed-map.ts` are waiting on a specific resource state. The following waits for a state machine to be `ACTIVE`: ```ts testCase.assertions .awsApiCall('StepFunctions', 'describeStateMachine', { stateMachineArn: stack.stateMachine.stateMachineArn, }) .expect(ExpectedResult.objectLike({ status: 'ACTIVE' })); ``` The following wait for the state machine execution to be `SUCCEEDED`: ```ts describe.expect(ExpectedResult.objectLike({ status: 'SUCCEEDED', })); ``` In the current format, the second assertion fails because the state machine execution is still running at the time the assertion is made. This causes the integ test to fail with the following error: ``` { "executionArn": "arn:aws:states:us-east-1:123456789012:execution:StateMachine2E01A3A5-OqZg4PaGWIUA:ecfc64d5-c20e-483b-a2ec-9ef8f82b2214", "input": "{}", "inputDetails": { ... }, "name": "ecfc64d5-c20e-483b-a2ec-9ef8f82b2214", "redriveCount": 0, "redriveStatus": "NOT_REDRIVABLE", "redriveStatusReason": "Execution is RUNNING and cannot be redriven", "startDate": {}, "stateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:StateMachine2E01A3A5-OqZg4PaGWIUA", !! Expected SUCCEEDED but received RUNNING "status": "RUNNING", "traceHeader": "Root=1-664c0401-4504db7463bcd92c490e52bc;Parent=5ea37aeb46708a96;Sampled=0" } ``` As a best practice, we should always ensure that assertions based on resource state have a `waitForAssertions` call to force the assertion to wait for the specific state to occur. ### Description of changes I added a `waitForAssertions` call to each assertion in this integ test that is waiting for a specific resource state. Each `waitForAssertions` call has the following waiter options: - A total timeout of 5 minutes, after which the assertion will fail. - A 10 second interval which will be used to check if the resource is in the expected state. ### Description of how you validated changes Re-ran the integ test and it succeeded. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Reason for this change
Two assertions made in
integ.distributed-map.ts
are waiting on a specific resource state. The following waits for a state machine to beACTIVE
:The following wait for the state machine execution to be
SUCCEEDED
:In the current format, the second assertion fails because the state machine execution is still running at the time the assertion is made. This causes the integ test to fail with the following error:
As a best practice, we should always ensure that assertions based on resource state have a
waitForAssertions
call to force the assertion to wait for the specific state to occur.Description of changes
I added a
waitForAssertions
call to each assertion in this integ test that is waiting for a specific resource state. EachwaitForAssertions
call has the following waiter options:Description of how you validated changes
Re-ran the integ test and it succeeded.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license