aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariusz Wagner <mariusz.wagner@nokia.com>2018-07-31 09:32:05 +0200
committerMariusz Wagner <mariusz.wagner@nokia.com>2018-07-31 13:58:59 +0200
commit7a1e0c8a922f60b9443179ca874d5966afdc54a7 (patch)
tree0d25bb57bb9837a6df8a305cccf69c6b888710d5
parent3cbe54761c77812594cf6c497482373e814792c1 (diff)
Cleaning tests
- Removed problem with version docker package - Change from python2 to python3 Issue-ID: INT-604 Change-Id: I4c5669926198569871634a7fed541b21aaa91eb9 Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
-rw-r--r--test/csit/plans/dcaegen2/prh-testsuites/setup.sh7
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml4
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py11
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator4
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py13
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator4
6 files changed, 18 insertions, 25 deletions
diff --git a/test/csit/plans/dcaegen2/prh-testsuites/setup.sh b/test/csit/plans/dcaegen2/prh-testsuites/setup.sh
index 058ed20bd..a5ce48b52 100644
--- a/test/csit/plans/dcaegen2/prh-testsuites/setup.sh
+++ b/test/csit/plans/dcaegen2/prh-testsuites/setup.sh
@@ -9,6 +9,9 @@ export AAI_SIMULATOR="aai_simulator"
cd ${WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/resources/
docker login -u docker -p docker nexus3.onap.org:10001
+pip uninstall -y docker-py
+pip uninstall -y docker
+pip install -U docker
docker-compose up -d --build
# Wait for initialization of Docker containers
@@ -37,7 +40,7 @@ echo PRH_IP=${PRH_IP}
echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP}
echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP}
-# Wait for initialization of docker services
+# Wait for initialization of PRH services
for i in {1..10}; do
curl -sS -m 1 localhost:8100/heartbeat && break
echo sleep ${i}
@@ -53,5 +56,3 @@ docker start prh
# #Pass any variables required by Robot test suites in ROBOT_VARIABLES
ROBOT_VARIABLES="-v DMAAP_SIMULATOR:${DMAAP_SIMULATOR_IP}:2222 -v AAI_SIMULATOR:${AAI_SIMULATOR_IP}:3333 -v PRH:${PRH_IP}:8100"
-
-pip install docker==2.7.0
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
index 3cac3b41b..b1f84fda2 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -25,8 +25,6 @@ services:
build:
context: simulator
dockerfile: DMaaP_simulator
- args:
- - https_proxy=${HTTPS_PROXY}
ports:
- "2222:2222"
container_name: dmaap_simulator
@@ -35,8 +33,6 @@ services:
build:
context: simulator
dockerfile: AAI_simulator
- args:
- - https_proxy=${HTTPS_PROXY}
ports:
- "3333:3333"
container_name: aai_simulator
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index ca8bdd1f6..e70d8d30f 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -1,11 +1,12 @@
-import BaseHTTPServer
+from http.server import BaseHTTPRequestHandler
+from http.server import HTTPServer
import re
import sys
pnfs = 'Empty'
-class AAIHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+class AAIHandler(BaseHTTPRequestHandler):
def do_PUT(self):
if re.search('/set_pnfs', self.path):
global pnfs
@@ -16,7 +17,7 @@ class AAIHandler(BaseHTTPServer.BaseHTTPRequestHandler):
return
def do_PATCH(self):
- pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs
+ pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode()
if re.search('wrong_aai_record', self.path):
self.send_response(400)
self.end_headers()
@@ -33,7 +34,7 @@ def _header_200_and_json(self):
self.end_headers()
-def _main_(handler_class=AAIHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+def _main_(handler_class=AAIHandler, server_class=HTTPServer, protocol="HTTP/1.0"):
if sys.argv[1:]:
port = int(sys.argv[1])
@@ -46,7 +47,7 @@ def _main_(handler_class=AAIHandler, server_class=BaseHTTPServer.HTTPServer, pro
httpd = server_class(server_address, handler_class)
sa = httpd.socket.getsockname()
- print "Serving HTTP on", sa[0], "port", sa[1], "..."
+ print("Serving HTTP on", sa[0], "port", sa[1], "...")
httpd.serve_forever()
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
index 9566c47a9..013cd0a65 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/AAI_simulator
@@ -1,9 +1,7 @@
-FROM python:2
+FROM python:3
ADD AAI.py /
-RUN pip install robotframework
-
EXPOSE 3333
CMD [ "python", "./AAI.py" ]
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
index dd2d19451..210378421 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -1,12 +1,13 @@
-import BaseHTTPServer
+from http.server import BaseHTTPRequestHandler
+from http.server import HTTPServer
import re
import sys
-posted_event_from_prh = 'Empty'
+posted_event_from_prh = b'Empty'
received_event_to_get_method = 'Empty'
-class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+class DMaaPHandler(BaseHTTPRequestHandler):
def do_PUT(self):
if re.search('/set_get_event', self.path):
global received_event_to_get_method
@@ -29,11 +30,9 @@ class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if re.search('/events/unauthenticated.SEC_OTHER_OUTPUT/OpenDcae-c12/c12', self.path):
_header_200_and_json(self)
self.wfile.write(received_event_to_get_method)
- self.wfile.close()
elif re.search('/events/pnfReady', self.path):
_header_200_and_json(self)
self.wfile.write(posted_event_from_prh)
- self.wfile.close()
return
@@ -44,7 +43,7 @@ def _header_200_and_json(self):
self.end_headers()
-def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
+def _main_(handler_class=DMaaPHandler, server_class=HTTPServer, protocol="HTTP/1.0"):
if sys.argv[1:]:
port = int(sys.argv[1])
@@ -57,7 +56,7 @@ def _main_(handler_class=DMaaPHandler, server_class=BaseHTTPServer.HTTPServer, p
httpd = server_class(server_address, handler_class)
sa = httpd.socket.getsockname()
- print "Serving HTTP on", sa[0], "port", sa[1], "..."
+ print("Serving HTTP on", sa[0], "port", sa[1], "...")
httpd.serve_forever()
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
index 20761e7e8..cf4160c89 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP_simulator
@@ -1,9 +1,7 @@
-FROM python:2
+FROM python:3
ADD DMaaP.py /
-RUN pip install robotframework
-
EXPOSE 2222
CMD [ "python", "./DMaaP.py" ]