Skip to content

Commit

Permalink
Wait till cs simulator deploys and then run integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
placccebo committed Aug 10, 2018
1 parent 82a4618 commit 77f9f6e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
20 changes: 15 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,36 @@ variables:
ADVERTISED_PORT: "9092"
KAFKA_HOST: spotify-kafka
KAFKA_PORT: "9092"
KAFKA_ACKS: all
KAFKA_TOPIC: cs
KAFKA_WRITE_RETRIES: "1"
CS_HOST: bwsw-cs-simulator-kafka
CS_PORT: 8888

stages:
- test
- it
- mirror

test:
image: hseeberger/scala-sbt:8u151-2.12.4-1.0.4
stage: test
script:
- sbt scalastyle test:scalastyle
- sbt clean coverage test coverageReport
coverage: '/Coverage was \[\d+.\d+\%\]/'
tags:
- build-in-docker
- cs-eco-builder

it:
image: hseeberger/scala-sbt:8u151-2.12.4-1.0.4
stage: it
services:
- spotify/kafka
- bwsw/cs-simulator-kafka:4.10.3-NP
script:
- sbt scalastyle test:scalastyle it:scalastyle
- sbt clean coverage test it:test coverageReport
coverage: '/Coverage was \[\d+.\d+\%\]/'
- chmod +x ./wait-cs-simulator.sh && ./wait-cs-simulator.sh
- sbt scalastyle it:scalastyle
- sbt clean it:test
tags:
- build-in-docker
- cs-eco-builder
Expand Down
2 changes: 2 additions & 0 deletions jenkins/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ echo "---------------------------------------------"

sh ./jenkins/run_cs_simulator.sh

sh wait-cs-simulator.sh

sbt it:test

echo "---------------------------------------------"
Expand Down
24 changes: 0 additions & 24 deletions jenkins/run_cs_simulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,3 @@ docker run --rm -e KAFKA_HOST="${KAFKA_HOST}" \
-e KAFKA_PORT="${KAFKA_PORT}" \
-e KAFKA_TOPIC="${KAFKA_TOPIC}" \
--name cs-simulator-kafka -d -p $CS_PORT:$CS_PORT bwsw/cs-simulator-kafka:4.10.3-NP

ITERATIONS=40
SLEEP=30

echo "wait for CloudStack simulator deploys"

for i in `seq 1 ${ITERATIONS}`
do
curl -s -I http://localhost:${CS_PORT}/client/ | head -1 | grep "200"

if [ $? -eq 0 ]
then
echo "OK"
break
else
echo "retry number $i"
sleep ${SLEEP}
fi

if [ ${i} -eq ${ITERATIONS} ]
then
exit 1
fi
done
23 changes: 23 additions & 0 deletions wait-cs-simulator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ITERATIONS=40
SLEEP=30

echo "wait for CloudStack simulator to deploy"

for i in `seq 1 ${ITERATIONS}`
do
curl -s -I http://${CS_HOST}:${CS_PORT}/client/ | head -1 | grep "200"

if [ $? -eq 0 ]
then
echo "OK"
break
else
echo "retry number $i"
sleep ${SLEEP}
fi

if [ ${i} -eq ${ITERATIONS} ]
then
exit 1
fi
done

0 comments on commit 77f9f6e

Please sign in to comment.