-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split tests job into separate tasks
- Loading branch information
1 parent
5e25166
commit f7ab21d
Showing
3 changed files
with
45 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
rc=0 | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
# Are there duplicated configuration variables? | ||
duplicates=$(cat conf/*.env | grep -o "^.*=.*" | sort | uniq -d) | ||
duplicate_cnt=0 | ||
for dup in $duplicates | ||
do | ||
echo "$dup" | ||
duplicate_cnt=$(($duplicate_cnt+1)) | ||
done | ||
if [ $duplicate_cnt -gt 0 ]; then | ||
echo -e "${RED} Error: Duplicated variables were found!${NC}" | ||
rc=$(($rc+1)) | ||
else | ||
echo "Variables are unique." | ||
fi | ||
|
||
# Simple test to compare variables used in code and specified in conf/*.env files, allows to set ignored variables | ||
not_configurable="CW_AWS_ACCESS_KEY_ID\|CW_AWS_SECRET_ACCESS_KEY\|SLACK_WEBHOOK\|VULNERABILITY_ENV"\ | ||
"\|MINIMAL_SCHEMA\|HOSTNAME\|DB_UPGRADE_SCRIPTS_DIR\|VE_DB_USER_ADVISOR_LISTENER_PASSWORD"\ | ||
"\|VE_DB_USER_EVALUATOR_PASSWORD\|VE_DB_USER_LISTENER_PASSWORD\|VE_DB_USER_MANAGER_PASSWORD"\ | ||
"\|VE_DB_USER_TASKOMATIC_PASSWORD\|VE_DB_USER_VMAAS_SYNC_PASSWORD\|VE_DB_USER_NOTIFICATOR_PASSWORD" | ||
not_in_code="API_URLS\|CYNDI_MOCK\|PGUSER" | ||
configurable_variables=$(cat conf/*.env | grep -o "^.*=" | sed 's/.$//g' | sort -u | grep -v "$not_in_code") | ||
code_variables=$(find . -name '*.py' -not -path './.venv/*' -not -path './scripts/*' -not -path './tests/*' -not -path './database/upgrade/*' -exec grep -oP "os\.getenv.*?\)|os\.environ\.get.*?\)" {} \; | awk -F"['\"]" '{print $2}' | sort -u | grep -v "$not_configurable") | ||
diff <(echo "$configurable_variables") <(echo "$code_variables") | ||
diff_rc=$? | ||
if [ $diff_rc -gt 0 ]; then | ||
echo -e "${RED} Error: Some variables in code or conf/*.env are missing!${NC}" | ||
else | ||
echo "Variables in code and conf/*.env are OK" | ||
fi | ||
rc=$(($rc+$diff_rc)) | ||
|
||
exit $rc |