-
Notifications
You must be signed in to change notification settings - Fork 42
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
Conversation
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.
Looks pretty straight-forward - just a few minor suggestions.
integ/scripts/bash/rfdk-integ-e2e.sh
Outdated
@@ -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" ] |
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.
How would you feel about using a more descriptive variable name? Say PRE_COMPONENT_HOOK
?
integ/scripts/bash/rfdk-integ-e2e.sh
Outdated
# 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 |
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.
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?
Can we scope the conventional commit title to |
43c013e
to
c039a10
Compare
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