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

feat(integ): add ability to use hook function before each component test #155

Merged
merged 1 commit into from
Oct 7, 2020

Conversation

kozlove-aws
Copy link
Contributor

@kozlove-aws kozlove-aws commented Oct 6, 2020

Problem

In the main integ-rfdk-e2e.sh we need to add the ability to run an extra function if it is designed.

Solution

Added functionality to invoke script in case when environment variable PRE_COMPONENT_HOOK is defined and function with such name was exported.

Testing

Script was tested locally with all cases like: correct function, undefined variable or function name is incorrect.


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

Copy link
Contributor

@jusiskin jusiskin left a comment

Choose a reason for hiding this comment

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

Looks pretty straight-forward - just a few minor suggestions.

@@ -71,6 +71,12 @@ export INFRASTRUCTURE_DEPLOY_FINISH_TIME=$SECONDS

# Pull the top level directory for each cdk app in the components directory
for COMPONENT in **/cdk.json; do
# Invoke hook function if it is exported and name is defined in HOOK_FUNCTION variable
if [ -n "$HOOK_FUNCTION" ] && [ "$(type -t $HOOK_FUNCTION)" == "function" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

How would you feel about using a more descriptive variable name? Say PRE_COMPONENT_HOOK?

# Invoke hook function if it is exported and name is defined in HOOK_FUNCTION variable
if [ -n "$HOOK_FUNCTION" ] && [ "$(type -t $HOOK_FUNCTION)" == "function" ]
then
$HOOK_FUNCTION
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any argument/parameters that might be useful to pass to the hook function? I'm trying to think in the general case if someone would need a hook function that is triggered before each component test, they'd likely be interested in knowing which component is being tested. Does it make sense to include the component name?

@jusiskin
Copy link
Contributor

jusiskin commented Oct 7, 2020

Can we scope the conventional commit title to feat(integ):? This is how we have scoped prior commits to the integration tests.

@jusiskin jusiskin changed the title feat: add ability to use hook function feat(integ): add ability to use hook function before each component test Oct 7, 2020
@kozlove-aws kozlove-aws force-pushed the add_use_hook_function branch from 43c013e to c039a10 Compare October 7, 2020 16:18
@kozlove-aws kozlove-aws closed this Oct 7, 2020
@kozlove-aws kozlove-aws reopened this Oct 7, 2020
@jusiskin jusiskin added the contribution/core This is a PR that came from AWS. label Oct 7, 2020
@ddneilson ddneilson merged commit 792586e into aws:mainline Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants