Enhanced ECS function tests
Documentation updates
Also includes re-factoring of some scripts and functions
Issue-ID: NONRTRIC-311
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: I891ab5b093699530c771b3d6177bfc24daae3b1d
diff --git a/test/mrstub/.gitignore b/test/mrstub/.gitignore
index e7940a2..d2a3fba 100644
--- a/test/mrstub/.gitignore
+++ b/test/mrstub/.gitignore
@@ -1,3 +1,4 @@
+tmp
.tmp.json
.dockererr
nginx_wsgi_flask/__init__.py
diff --git a/test/mrstub/Dockerfile b/test/mrstub/Dockerfile
index 513894c..5219e74 100644
--- a/test/mrstub/Dockerfile
+++ b/test/mrstub/Dockerfile
@@ -15,7 +15,9 @@
# ============LICENSE_END=================================================
#
-FROM python:3.8-slim-buster
+ARG NEXUS_PROXY_REPO
+
+FROM ${NEXUS_PROXY_REPO}python:3.8-slim-buster
COPY app/ /usr/src/app/
COPY cert/ /usr/src/app/cert/
diff --git a/test/mrstub/README.md b/test/mrstub/README.md
index e8e8edf..4365d76 100644
--- a/test/mrstub/README.md
+++ b/test/mrstub/README.md
@@ -59,10 +59,10 @@
### Build and start ###
>Build image<br>
-```docker build -t mrstub .```
+```docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t mrstub .```
>Start the image on http only<br>
-```docker run -it -p 3905:3905 mrstub```
+```docker run --rm -it -p 3905:3905 mrstub```
>Start the image on http and https<br>
By default, this image has default certificates under /usr/src/app/cert
@@ -72,20 +72,20 @@
file "pass" stores the password when you run the shell script
Start the a1-interface container without specifing external certificates:
-```docker run -it -p 3905:3905 -p 3906:3906 mrstub```
+```docker run --rm -it -p 3905:3905 -p 3906:3906 mrstub```
It will listen to http 3905 port and https 3906 port(using default certificates) at the same time.
This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
In 'docker run', use field:
--volume "$PWD/certificate:/usr/src/app/cert" a1test
-```docker run -it -p 3905:3905 -p 3906:3906 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" mrstub```
+```docker run --rm -it -p 3905:3905 -p 3906:3906 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" mrstub```
In 'docker-compose.yml', use field:
volumes:
- ./certificate:/usr/src/app/cert:ro
The script ```mrstub-build-start.sh``` do the build and docker run in one go. This starts the stub container in stand-alone mode for basic test.<br>If the mrstub should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be the same as configured in consul for the read and write streams).
-```docker run -it -p 3905:3905 --network nonrtric-docker-net --name message-router mrstub```
+```docker run --rm -it -p 3905:3905 --network nonrtric-docker-net --name message-router mrstub```
### Basic test ###
diff --git a/test/mrstub/app/main.py b/test/mrstub/app/main.py
index 8804a04..75b23f1 100644
--- a/test/mrstub/app/main.py
+++ b/test/mrstub/app/main.py
@@ -25,6 +25,15 @@
from flask import Response
import traceback
from threading import RLock
+import logging
+
+# Disable all logging of GET on reading counters
+class AjaxFilter(logging.Filter):
+ def filter(self, record):
+ return ("/counter/" not in record.getMessage())
+
+log = logging.getLogger('werkzeug')
+log.addFilter(AjaxFilter())
app = Flask(__name__)
lock = RLock()
diff --git a/test/mrstub/mrstub-build-start.sh b/test/mrstub/mrstub-build-start.sh
index 3e43116..8ad1d16 100755
--- a/test/mrstub/mrstub-build-start.sh
+++ b/test/mrstub/mrstub-build-start.sh
@@ -19,6 +19,6 @@
#Builds the mrstub container and starts it in interactive mode
-docker build -t mrstub .
+docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t mrstub .
-docker run -it -p 3905:3905 -p 3906:3906 -v "$PWD/cert:/usr/src/app/cert" mrstub
+docker run --rm -it -p 3905:3905 -p 3906:3906 -v "$PWD/cert:/usr/src/app/cert" mrstub