-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.sh
62 lines (51 loc) · 1.86 KB
/
startup.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
57
58
59
60
61
62
#!/bin/bash
# Get arguments as environment variables
export APP_BUILD=$1
export TEST_PHASE=$2
## Start the ssh service
/usr/sbin/sshd
## Clear the src folder
cd /src
rm -rf *
## Start the Xvfb virtual display service
cd
# create an Xvfb virtual display in the background (another screen size: 1080x1440x24)
Xvfb :99 -ac -screen 0 1680x1080x24 &
sleep 5 # wait for Xvfb display server session to be ready
export DISPLAY=:99
## Start a vnc session to the virtual display created above
x11vnc -forever -usepw -display :99 &
# -geometry 1680x1080
# Grant file permission
chown -R cobalt /home/cobalt/
## Run cucumber, report handler, and convert nginx conf file
su cobalt <<'EOF'
cd
source /home/cobalt/.rvm/scripts/rvm
echo $(ruby -v)
mkdir $APP_BUILD
mkdir $APP_BUILD/$TEST_PHASE
mkdir $APP_BUILD/$TEST_PHASE/cucumber-result
mkdir $APP_BUILD/$TEST_PHASE/cucumber-result/logs
mkdir $APP_BUILD/$TEST_PHASE/cucumber-result/screenshots
mkdir $APP_BUILD/$TEST_PHASE/cucumber-result/cuke-report
mkdir $APP_BUILD/$TEST_PHASE/cucumber-result/junit
cd /home/cobalt/cucumber
echo "Xvfb display number:"
echo $DISPLAY
echo "Installing/updating gems in case of changes..."
bundle install
echo "Running cucumber..."
# bundle exec parallel_cucumber features/ -o "-p html_each"
cucumber -p html_each features/
ruby results_XML_handler.rb
erb /home/cobalt/cucumber/cucumber_nginx.conf.erb > /home/cobalt/cucumber/cucumber_nginx.conf
EOF
## Copy cucumber html results to the default Nginx content folder
# cp /home/cobalt/cucumber/results.html /usr/share/nginx/html
# cp -rf /home/cobalt/cucumber_results /usr/share/nginx/html
## Start Nginx server
# using global directive 'daemon off' to
# ensure the docker container does not halt after Nginx spawns its processes
echo "Starting Nginx server with customized configuration..."
/usr/sbin/nginx -g 'daemon off;' -c /home/cobalt/cucumber/cucumber_nginx.conf