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(custom-resources): running Python tests from Lerna #28860

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/custom-resource-handlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"package": "cdk-package",
"awslint": "cdk-awslint",
"pkglint": "pkglint -f",
"test": "jest",
"test": "./test.sh",
"watch": "cdk-watch",
"build+test": "yarn build && yarn test",
"build+test+package": "yarn build+test && yarn package",
Expand Down
26 changes: 26 additions & 0 deletions packages/@aws-cdk/custom-resource-handlers/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -u

cd "$(dirname "$0")"

# This script runs all tests in this package, including tests written in Python.
# If any arguments are passed to this script, it passes them to Jest and runs only the tests that match the pattern.

if [ "$#" -gt 0 ]; then
yarn run jest "$@"
else
tests=(
"yarn run jest"
"./test/aws-s3/notifications-resource-handler/test.sh"
"./test/aws-s3-deployment/bucket-deployment-handler/test.sh"
)

# Run all tests and exit 1 if any of them failed
exit_status=0
for test in "${tests[@]}"; do
$test || exit_status=1
done

exit $exit_status
fi
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def test_fails_when_physical_id_not_present_in_update(self):
"DestinationBucketName": "<dest-bucket-name>",
}, expected_status="FAILED")

self.assertEqual(update_resp['Reason'], "invalid request: request type is 'Update' but 'PhysicalResourceId' is not defined")
self.assertEqual(update_resp['Reason'], "invalid request: request type is '{'Update'}' but 'PhysicalResourceId' is not defined")
Copy link
Contributor Author

@sakurai-ryo sakurai-ryo Jan 25, 2024

Choose a reason for hiding this comment

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

Changed in this PR, but the test code did not.
#28057


def test_fails_when_physical_id_not_present_in_delete(self):
def mock_make_api_call(self, operation_name, kwarg):
Expand All @@ -601,7 +601,7 @@ def mock_make_api_call(self, operation_name, kwarg):
"DestinationBucketName": "<dest-bucket-name>",
}, expected_status="FAILED")

self.assertEqual(update_resp['Reason'], "invalid request: request type is 'Delete' but 'PhysicalResourceId' is not defined")
self.assertEqual(update_resp['Reason'], "invalid request: request type is '{'Delete'}' but 'PhysicalResourceId' is not defined")

def test_physical_id_on_cloud_front_error(self):
def mock_make_api_call(self, operation_name, kwarg):
Expand Down
Loading