-
Notifications
You must be signed in to change notification settings - Fork 10
/
entrypoint.sh
executable file
·56 lines (46 loc) · 1.47 KB
/
entrypoint.sh
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
#!/bin/bash
set -e
TOTAL_CHAOS_DURATION=${TOTAL_CHAOS_DURATION:=60}
TEST_TIMEOUT=$((600 + $TOTAL_CHAOS_DURATION))
PARALLEL_EXECUTION=${PARALLEL_EXECUTION:=1}
##Extract the base64 encoded config data and write this to the KUBECONFIG
if [ ! -z "$KUBE_CONFIG_DATA" ]
then
mkdir -p ${HOME}/.kube
echo "$KUBE_CONFIG_DATA" | base64 --decode > ${HOME}/.kube/config
export KUBECONFIG=${HOME}/.kube/config
fi
##Setup
mkdir -p $HOME/go/src/github.com/litmuschaos
cd ${GOPATH}/src/github.com/litmuschaos/
dir=${GOPATH}/src/github.com/litmuschaos/chaos-ci-lib
if [[ ! -z $AWS_ACCESS_KEY_ID ]] && [[ ! -z $AWS_SECRET_ACCESS_KEY ]] && [[ ! -z $AWS_DEFAULT_REGION ]]
then
aws configure set default.region ${AWS_DEFAULT_REGION}
aws configure set aws_access_key_id ${AWS_ACCESS_KEY_ID}
aws configure set aws_secret_access_key ${AWS_SECRET_ACCESS_KEY}
fi
if [ ! -d $dir ]
then
git clone https://github.com/litmuschaos/chaos-ci-lib.git
fi
cd chaos-ci-lib
##Install litmus if it is not already installed
if [ "$INSTALL_LITMUS" == "true" ]
then
go test litmus/install-litmus_test.go -v -count=1
fi
if [ "$EXPERIMENT_NAME" == "all" ]; then
## Run all BDDs
cd experiments
ginkgo -nodes=${PARALLEL_EXECUTION}
cd ..
elif [ ! -z "$EXPERIMENT_NAME" ]; then
## Run the selected chaos experiment
go test experiments/${EXPERIMENT_NAME}_test.go -v -count=1 -timeout=${TEST_TIMEOUT}s
fi
##litmus cleanup
if [ "$LITMUS_CLEANUP" == "true" ]
then
go test litmus/uninstall-litmus_test.go -v -count=1
fi