0b77a9378900bded77217fdf752ddbe833e67366
[testsuite.git] / setup.sh
1 #!/bin/bash
2 #
3 # setup : script to setup required runtime environment. This script can be run again to update anything
4 # this should stay in your project directory
5
6
7 # save console output in setup_<timestamp>.log file in project directory
8 timestamp=$(date +"%m%d%Y_%H%M%S")
9 LOG_FILE=setup_$timestamp.log
10 exec > >(tee -a ${LOG_FILE} )
11 exec 2> >(tee -a ${LOG_FILE} >&2)
12
13
14 # get the path
15 path=$(pwd)
16 pip install \
17 --no-cache-dir \
18 --exists-action s \
19 --target="$path/robot/library" \
20 'selenium<=3.0.0' \
21 'robotframework-selenium2library==1.8.0' \
22 'robotframework-databaselibrary==0.8.1' \
23 'robotframework-extendedselenium2library==0.9.1' \
24 'robotframework-requests==0.5.0' \
25 'robotframework-sshlibrary==2.1.2' \
26 'robotframework-sudslibrary==0.8' \
27 'robotframework-ftplibrary==1.3' \
28 'robotframework-rammbock==0.4.0.1' \
29 'robotframework-httplibrary==0.4.2' \
30 'robotframework-archivelibrary==0.3.2' \
31 'robotframework-kafkalibrary==0.0.2'
32
33
34 # get the git for the eteutils you will need to add a private key to your ssh before this
35 if [ -d $path/testsuite/eteutils ]
36 then
37     # Support LF build location
38         cd $path/testsuite/eteutils
39 else
40         cd ~
41         git config --global http.sslVerify false
42         if [ -d ~/python-testing-utils ]
43         then
44                 cd python-testing-utils
45                 git pull origin master
46         else
47                 git clone https://gerrit.onap.org/r/testsuite/python-testing-utils.git
48                 cd python-testing-utils
49         fi
50 fi
51
52 pip install \
53 --no-cache-dir \
54 --upgrade \
55 --exists-action s \
56 --target="$path/robot/library" ./robotframework-onap
57
58
59 if [ -d $path/testsuite/heatbridge ]
60 then
61     # Support LF build location
62         cd $path/testsuite/heatbridge
63 else
64         cd ~
65         git config --global http.sslVerify false
66         if [ -d ~/heatbridge ]
67         then
68                 cd heatbridge
69                 git pull origin master
70         else
71                 git clone https://gerrit.onap.org/r/testsuite/heatbridge.git
72                 cd heatbridge
73         fi
74 fi
75
76 pip install \
77 --no-cache-dir \
78 --upgrade \
79 --exists-action s \
80 --target="$path/robot/library" \
81 ./heatbridge
82
83
84 # NOTE: Patch to incude explicit install of paramiko to 2.0.2 to work with sshlibrary 2.1.2
85 # This should be removed on new release of paramiko (2.1.2) or sshlibrary
86 # https://github.com/robotframework/SSHLibrary/issues/157
87 pip install \
88 --no-cache-dir \
89 --target="$path/robot/library" \
90 -U 'paramiko==2.0.2'
91
92
93 # Go back to execution folder
94 cd $path
95
96 # if the script is running during the image build skip the rest of it
97 # as required software is installed already.
98 if $BUILDTIME
99 then
100         # we need to update PATH with chromium-chromedriver
101         echo "Adding in-container chromedriver to PATH"
102         ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/chromedriver
103         
104         echo "Skipping desktop steps, building container image..."
105 else    
106         #
107         # Get the appropriate chromedriver. Default to linux64
108         #
109         CHROMEDRIVER_URL=http://chromedriver.storage.googleapis.com/2.43
110         CHROMEDRIVER_ZIP=chromedriver_linux64.zip
111         CHROMEDRIVER_TARGET=chromedriver.zip
112
113         # Handle mac and windows
114         OS=`uname -s`
115         case $OS in
116           MINGW*_NT*)
117                 CHROMEDRIVER_ZIP=chromedriver_win32.zip
118                 ;;
119           Darwin*)
120                 CHROMEDRIVER_ZIP=chromedriver_mac64.zip
121                 ;;
122           *) echo "Defaulting to Linux 64" ;;
123         esac
124
125         if [ $CHROMEDRIVER_ZIP == 'chromedriver_linux64.zip' ]
126         then
127             curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
128                 unzip chromedriver.zip -d /usr/local/bin
129         else
130             curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
131                 unzip $CHROMEDRIVER_TARGET
132         fi
133         rm -rf $CHROMEDRIVER_TARGET
134 fi
135
136 #
137 # Install kafkacat : https://github.com/edenhill/kafkacat
138 #
139 OS=`uname -s`
140 case $OS in
141         Darwin)
142                 brew install kafkacat ;;
143         Linux)
144                 apt-get -y install kafkacat
145 esac
146 #
147 # Install protobuf
148 #
149 OS=`uname -s`
150 case $OS in
151         Darwin)
152                 brew install protobuf ;;
153         Linux)
154                 apt-get -y install protobuf-compiler
155 esac