-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathdev-test.sh
More file actions
74 lines (70 loc) · 5.29 KB
/
dev-test.sh
File metadata and controls
74 lines (70 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
python -m pip install --upgrade pip && pip install -r requirements.txt
# Install OPA binary
curl -L -o /usr/local/bin/opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64_static
chmod +x /usr/local/bin/opa
export OPA_HOME=/usr/local/bin
export BASEDIR=`pwd`
export FRAMEWORKDIR=`pwd`
export PYTHONPATH=$FRAMEWORKDIR/src
python utilities/validator.py --help
py.test --cov=processor tests/processor --cov-report term-missing
if [ $? -ne 0 ]; then echo "Unit tests failed"; exit 1; fi
git clone https://github.com/prancer-io/prancer-hello-world.git
cd $BASEDIR/prancer-hello-world
export FRAMEWORKDIR=`pwd`
cd $BASEDIR
#scenario simple pass and fail
python utilities/validator.py --db NONE scenario-pass
pass_success=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-pass/output-test.json`
fail_error=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-pass/output-test.json`
if [[ -z "$pass_success" ]] || [[ ! -z "$failed_error" ]] ; then echo "scenario-pass failed"; exit 1;fi
python utilities/validator.py --db NONE scenario-fail
fail_success=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-fail/output-test.json`
pass_error=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-fail/output-test.json`
if [[ -z "$fail_success" ]] || [[ ! -z "$pass_error" ]] ; then echo "scenario-fail failed"; exit 1;fi
#scenario arm
python utilities/validator.py --db NONE scenario-arm-pass --crawler
python utilities/validator.py --db NONE scenario-arm-pass
pass_success=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-arm-pass/output-master-test.json`
fail_error=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-arm-pass/output-master-test.json`
if [[ -z "$pass_success" ]] || [[ ! -z "$failed_error" ]] ; then echo "scenario-arm-pass failed"; exit 1;fi
python utilities/validator.py --db NONE scenario-arm-fail --crawler
python utilities/validator.py --db NONE scenario-arm-fail
fail_success=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-arm-fail/output-master-test.json`
pass_error=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-arm-fail/output-master-test.json`
if [[ -z "$fail_success" ]] || [[ ! -z "$pass_error" ]] ; then echo "scenario-arm-fail failed"; exit 1;fi
#scenario cloudformation
python utilities/validator.py --db NONE scenario-cloudformation-pass --crawler
python utilities/validator.py --db NONE scenario-cloudformation-pass
pass_success=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-cloudformation-pass/output-master-test.json`
fail_error=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-cloudformation-pass/output-master-test.json`
if [[ -z "$pass_success" ]] || [[ ! -z "$failed_error" ]] ; then echo "scenario-cloudformation-pass failed"; exit 1;fi
python utilities/validator.py --db NONE scenario-cloudformation-fail --crawler
python utilities/validator.py --db NONE scenario-cloudformation-fail
fail_success=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-cloudformation-fail/output-master-test.json`
pass_error=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-cloudformation-fail/output-master-test.json`
if [[ -z "$fail_success" ]] || [[ ! -z "$pass_error" ]] ; then echo "scenario-cloudformation-fail failed"; exit 1;fi
#scenario deploymentmanager
python utilities/validator.py --db NONE scenario-deploymentmanager-pass --crawler
python utilities/validator.py --db NONE scenario-deploymentmanager-pass
pass_success=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-deploymentmanager-pass/output-master-test.json`
fail_error=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-deploymentmanager-pass/output-master-test.json`
if [[ -z "$pass_success" ]] || [[ ! -z "$failed_error" ]] ; then echo "scenario-deploymentmanager-pass failed"; exit 1;fi
python utilities/validator.py --db NONE scenario-deploymentmanager-fail --crawler
python utilities/validator.py --db NONE scenario-deploymentmanager-fail
fail_success=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-deploymentmanager-fail/output-master-test.json`
pass_error=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-deploymentmanager-fail/output-master-test.json`
if [[ -z "$fail_success" ]] || [[ ! -z "$pass_error" ]] ; then echo "scenario-deploymentmanager-fail failed"; exit 1;fi
#scenario kubernetes
python utilities/validator.py --db NONE scenario-kubernetes-pass --crawler
python utilities/validator.py --db NONE scenario-kubernetes-pass
pass_success=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-kubernetes-pass/output-master-test.json`
fail_error=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-kubernetes-pass/output-master-test.json`
if [[ -z "$pass_success" ]] || [[ ! -z "$failed_error" ]] ; then echo "scenario-kubernetes-pass failed"; exit 1;fi
python utilities/validator.py --db NONE scenario-kubernetes-fail --crawler
python utilities/validator.py --db NONE scenario-kubernetes-fail
fail_success=`grep failed $BASEDIR/prancer-hello-world/validation/scenario-kubernetes-fail/output-master-test.json`
pass_error=`grep passed $BASEDIR/prancer-hello-world/validation/scenario-kubernetes-fail/output-master-test.json`
if [[ -z "$fail_success" ]] || [[ ! -z "$pass_error" ]] ; then echo "scenario-kubernetes-fail failed"; exit 1;fi
chmod -R 777 $BASEDIR
exit 0