From b7d8088b1b734ef9c6a03af9b9b930d0facb311e Mon Sep 17 00:00:00 2001 From: Joshua Leaverton Date: Mon, 15 Jun 2020 12:17:48 -0400 Subject: [PATCH] Updated to v2.3.3 - Added unit test script --- deployment/run-unit-tests.sh | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 deployment/run-unit-tests.sh diff --git a/deployment/run-unit-tests.sh b/deployment/run-unit-tests.sh new file mode 100755 index 0000000..06fb6b4 --- /dev/null +++ b/deployment/run-unit-tests.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# This assumes all of the OS-level configuration has been completed and git repo has already been cloned +# +# This script should be run from the repo's deployment directory +# cd deployment +# ./run-unit-tests.sh +# + +# Get reference for all important folders +template_dir="$PWD" +source_dir="$template_dir/../source" + +echo "------------------------------------------------------------------------------" +echo "[Init] Clean old dist and node_modules folders" +echo "------------------------------------------------------------------------------" +echo "find $source_dir -iname \"node_modules\" -type d -exec rm -r \"{}\" \; 2> /dev/null" +find "$source_dir" -iname "node_modules" -type d -exec rm -r "{}" \; 2> /dev/null + +echo "find $source_dir -iname \"dist\" -type d -exec rm -r \"{}\" \; 2> /dev/null" +find "$source_dir" -iname "dist" -type d -exec rm -r "{}" \; 2> /dev/null + +echo "find ../ -type f -name 'package-lock.json' -delete" +find "$source_dir" -type f -name 'package-lock.json' -delete + +echo "------------------------------------------------------------------------------" +echo "[Test] Reputation Lists Parser" +echo "------------------------------------------------------------------------------" +cd "$source_dir"/reputation-lists-parser || exit 1 +npm install +npm test + +echo "pwd: current directory" +pwd + +echo "------------------------------------------------------------------------------" +echo "[Test] Build Athena Queries" +echo "------------------------------------------------------------------------------" +echo 'pip3 install -r ../tests/testing_requirements.txt' +pip3 install -r ../tests/testing_requirements.txt +echo 'pytest -s ../tests' +pytest -s ../tests \ No newline at end of file