Skip to content

Commit

Permalink
e2e test and associated Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
avinash-sudhodanan committed Nov 29, 2017
1 parent 8533e0c commit 6395f19
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
49 changes: 49 additions & 0 deletions e2e-test/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
node('docker') {

stage('Preparation') {

def mycontainer = docker.image('elastest/ci-docker-e2e:latest')
mycontainer.pull()
mycontainer.inside("-u jenkins -v /var/run/docker.sock:/var/run/docker.sock:rw -v /dev/shm:/dev/shm") {
sh '/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &'
git 'https://github.com/elastest/elastest-monitoring-service.git'

stage('ElasTest starting'){
sh "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock elastest/platform stop"
try {
sh "docker rm -f elastest-platform"
} catch(e) {
echo "Error: $e"
}

sh "docker run --name elastest-platform -d --rm -v /var/run/docker.sock:/var/run/docker.sock elastest/platform start --mode experimental-lite"
sh "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock elastest/platform wait --running=240"
sh "docker logs elastest-platform"

containerId= sh (
script: 'cat /proc/self/cgroup | grep "docker" | sed s/\\\\//\\\\n/g | tail -1',
returnStdout: true
).trim()

echo "containerId = ${containerId}"
sh "docker network connect elastest_elastest "+ containerId
etEmpApi= sh (
script: 'docker inspect --format=\\"{{.NetworkSettings.Networks.elastest_elastest.IPAddress}}\\" elastest_etm_1',
returnStdout: true
).trim()
echo "ETM container IP=${etEmpApi}"

elastestURL= sh(
script: 'docker run --rm -v /var/run/docker.sock:/var/run/docker.sock elastest/platform wait --running=240 | grep available | sed "s/.*at //"',
returnStdout: true
).trim()
echo "Elastest URL=${elastestURL}"
}

stage ("E2E tests") {
cd e2e-test
python e2etest.py ${elastestURL}"
}
}
}
}
17 changes: 17 additions & 0 deletions e2e-test/e2etest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest
import requests
import os
import sys

def e2etests():
tormurl=sys.argv[1]
print tormurl
#proxyurl="http://" + "localhost" + ":8080/"

#def test_send_request(self):
# s=requests.Session()
# response=s.get(tormurl)
# assert "ElasTest Torm" in response.text

if __name__=="__main__":
e2etests()

0 comments on commit 6395f19

Please sign in to comment.