From 63c8a87efc9415c20eeaadd230c8b22ddba1938f Mon Sep 17 00:00:00 2001 From: sro Date: Thu, 18 Jan 2018 16:58:34 +0100 Subject: [PATCH] e2e tests for eds tjobs --- DockerFile | 42 ++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 +++ tjobs.py | 13 +++++++++++++ tjobs_request.py | 21 +++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100755 DockerFile create mode 100755 requirements.txt create mode 100755 tjobs.py create mode 100755 tjobs_request.py diff --git a/DockerFile b/DockerFile new file mode 100755 index 0000000..d389ccf --- /dev/null +++ b/DockerFile @@ -0,0 +1,42 @@ +FROM python:2.7-slim + +#RUN mkdir -p /home/elastest/eds/eds-e2e + +WORKDIR /app + +# Copy the current directory contents into the container at /app +ADD . /app + + +# install packages and clean up +RUN printf "Starting update...\n" && \ + apt-get update -qq && \ + printf "Update finished.\n" && \ + printf "Starting dist-upgrade...\n" && \ + apt-get dist-upgrade -y > /dev/null && \ + printf "Upgrade finished.\n" && \ + printf "Starting install...\n" && \ + apt-get install -y \ + curl \ + build-essential \ + netbase \ + iproute2 \ + python-pip \ + python-dev \ + libev-dev \ + gcc \ + make \ + automake \ + jq > /dev/null && \ + apt-get clean && \ + printf "Installation and cleanup finished.\n" + + + +# Install any needed packages specified in requirements.txt +RUN pip install --trusted-host pypi.python.org -r requirements.txt + +# Make port 80 available to the world outside this container +EXPOSE 7070 + +CMD ["python"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100755 index 0000000..5b64fd8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +selenium +requests +setuptools \ No newline at end of file diff --git a/tjobs.py b/tjobs.py new file mode 100755 index 0000000..7563bf1 --- /dev/null +++ b/tjobs.py @@ -0,0 +1,13 @@ +import unittest +import requests +import os + + +class TJob(unittest.TestCase): + # proxyurl="http://" + os.environ['ET_SUT_HOST'] + ":8080/" + print "Value of the Environment variable ET_EUS_API is:" + os.environ['JAVA_HOME'] + print "Value of the Environment variable ET_ETM_API is:" + os.environ['ET_ETM_API'] + + +if __name__ == "__main__": + unittest.main() diff --git a/tjobs_request.py b/tjobs_request.py new file mode 100755 index 0000000..d9caa90 --- /dev/null +++ b/tjobs_request.py @@ -0,0 +1,21 @@ +import unittest +import requests +import os +import sys + + +class TJob(): + proxyurl = "http://" + str(sys.argv[1]) + ":8080/" + proxies = {'http': proxyurl, 'https': proxyurl} + + def test_send_request(self): + s = requests.Session() + response = s.get('http://www.elastest.io/', proxies=self.proxies, verify=False) + # response=s.get('http://etm:8091/') + print response.headers + assert "Elastest" in response.text + + +if __name__ == "__main__": + tjob = TJob() + tjob.test_send_request()