aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsteroide <thomas.duval@orange.com>2018-02-19 15:34:12 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-02-19 15:34:12 +0000
commite36a301b551e454ea8c28aa2beefd8f535d8f6fe (patch)
treec5e7fae4158b6c33b029a5397021e16731ace6d8
parentf4c44ba00f07c75099fbf0316c9e3bc53b83f30d (diff)
parentb38ecccb8ab9cd1e631f89c92f6b88e420b2a1b0 (diff)
Merge "Add the moon_pythonfunctest container to perform functionnal tests"
-rw-r--r--moon_forming/Dockerfile4
-rw-r--r--moon_forming/switch.sh19
-rw-r--r--moon_manager/tests/functional_pod/test_models.py5
-rw-r--r--moon_pythonfunctest/Dockerfile9
-rw-r--r--moon_pythonfunctest/README.md8
-rwxr-xr-xmoon_pythonfunctest/run_func_test.sh15
-rw-r--r--moon_pythonunittest/run_tests.sh6
-rw-r--r--tests/functional/run_tests_for_component.sh4
-rw-r--r--tools/moon_kubernetes/conf/moon.conf2
-rw-r--r--tools/moon_kubernetes/templates/moon_functest.yaml (renamed from tools/moon_kubernetes/templates/moon_forming_functest.yaml)7
10 files changed, 44 insertions, 35 deletions
diff --git a/moon_forming/Dockerfile b/moon_forming/Dockerfile
index 74616c89..ffae02c5 100644
--- a/moon_forming/Dockerfile
+++ b/moon_forming/Dockerfile
@@ -3,9 +3,7 @@ FROM python:3
WORKDIR /usr/src/app
RUN pip install --no-cache-dir --upgrade requests pytest pyyaml python_moonutilities python_moondb python_moonclient
-ENV COMMAND "config"
-
ADD . /root
WORKDIR /root
-CMD /bin/bash /root/switch.sh ${COMMAND}
+CMD /bin/bash /root/config_moon.sh
diff --git a/moon_forming/switch.sh b/moon_forming/switch.sh
deleted file mode 100644
index adb1ebe9..00000000
--- a/moon_forming/switch.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-
-CMD=$1
-
-echo "COMMAND IS ${CMD}"
-
-if [ "${CMD}" = "functest" ]; then
- echo "FUNCTIONAL TESTS"
- ls -l /data
- ls -l /data/tests
- sh /data/tests/functional_pod/run_functional_tests.sh
-#elif [ $CMD == "unittest" ]; then
-# sh /data/tests/functional_pod/run_functional_tests.sh
-else
- echo "CONFIGURATION"
- bash config_moon.sh
-fi
-
-echo "<END OF JOB>" \ No newline at end of file
diff --git a/moon_manager/tests/functional_pod/test_models.py b/moon_manager/tests/functional_pod/test_models.py
index dcda9f32..8b4ceef5 100644
--- a/moon_manager/tests/functional_pod/test_models.py
+++ b/moon_manager/tests/functional_pod/test_models.py
@@ -32,9 +32,10 @@ def delete_models(context, name):
request = None
for key, value in models['models'].items():
if value['name'] == name:
- request = requests.delete("http://{}:{}/models/{}".format(key,
+ request = requests.delete("http://{}:{}/models/{}".format(
context.get("hostname"),
- context.get("port")),
+ context.get("port"),
+ key),
timeout=3)
break
return request
diff --git a/moon_pythonfunctest/Dockerfile b/moon_pythonfunctest/Dockerfile
new file mode 100644
index 00000000..8ae093b8
--- /dev/null
+++ b/moon_pythonfunctest/Dockerfile
@@ -0,0 +1,9 @@
+FROM python:3
+
+WORKDIR /usr/src/app
+RUN pip install --no-cache-dir --upgrade requests pytest pyyaml python_moonutilities python_moondb python_moonclient
+
+ADD . /root
+WORKDIR /root
+
+CMD /bin/bash /root/run_func_test.sh
diff --git a/moon_pythonfunctest/README.md b/moon_pythonfunctest/README.md
new file mode 100644
index 00000000..e2a4d14b
--- /dev/null
+++ b/moon_pythonfunctest/README.md
@@ -0,0 +1,8 @@
+# Python Functional Test Docker
+
+## Build
+- `docker image build -t wukongsun/moon_python_func_test .`
+
+## Push to DockerHub
+- `docker login --username=wukongsun`
+- `docker image push wukongsun/moon_python_func_test`
diff --git a/moon_pythonfunctest/run_func_test.sh b/moon_pythonfunctest/run_func_test.sh
new file mode 100755
index 00000000..acd0e1e9
--- /dev/null
+++ b/moon_pythonfunctest/run_func_test.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+echo "Running functional tests :"
+
+#ls -l /data
+ls -l /data/tests
+
+if [ -f /data/tests/functional_pod/run_functional_tests.sh ];
+then
+ echo "running script..."
+ bash /data/tests/functional_pod/run_functional_tests.sh;
+fi
+
+echo "<END OF JOB>"
+
diff --git a/moon_pythonunittest/run_tests.sh b/moon_pythonunittest/run_tests.sh
index 6c586f87..8175d00b 100644
--- a/moon_pythonunittest/run_tests.sh
+++ b/moon_pythonunittest/run_tests.sh
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
cd /data
-pip3 install -r tests/unit_python/requirements.txt --upgrade
-pip3 install .
+#pip3 install -r tests/python_unit/requirements.txt --upgrade
+#pip3 install .
if [ -f /data/tests/unit_python/run_tests.sh ];
then
bash /data/tests/unit_python/run_tests.sh;
fi
-cd /data/tests/unit_python
+cd /data/tests/python_python
pytest .
diff --git a/tests/functional/run_tests_for_component.sh b/tests/functional/run_tests_for_component.sh
index fd9ab7fa..6c6a0330 100644
--- a/tests/functional/run_tests_for_component.sh
+++ b/tests/functional/run_tests_for_component.sh
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
CUR_PWD=$(pwd)
-INPUT_FILE=../tools/moon_kubernetes/templates/moon_forming_functest.yaml
-OUTPUT_FILE=tests/functional_pod/moon_forming_functest.yaml
+INPUT_FILE=../tools/moon_kubernetes/templates/moon_functest.yaml
+OUTPUT_FILE=tests/functional_pod/moon_functest.yaml
echo current working directory: ${CUR_PWD}
diff --git a/tools/moon_kubernetes/conf/moon.conf b/tools/moon_kubernetes/conf/moon.conf
index 28ad7a8e..e242125b 100644
--- a/tools/moon_kubernetes/conf/moon.conf
+++ b/tools/moon_kubernetes/conf/moon.conf
@@ -67,7 +67,7 @@ logging:
handlers:
console:
class : logging.StreamHandler
- formatter: brief
+ formatter: custom
level : INFO
stream : ext://sys.stdout
file:
diff --git a/tools/moon_kubernetes/templates/moon_forming_functest.yaml b/tools/moon_kubernetes/templates/moon_functest.yaml
index 4cb2c3a0..d70ebb96 100644
--- a/tools/moon_kubernetes/templates/moon_forming_functest.yaml
+++ b/tools/moon_kubernetes/templates/moon_functest.yaml
@@ -10,10 +10,7 @@ spec:
spec:
containers:
- name: functest
- image: wukongsun/moon_forming:dev
- env:
- - name: COMMAND
- value: "functest"
+ image: wukongsun/moon_python_func_test:latest
volumeMounts:
- name: config-volume
mountPath: /etc/moon
@@ -27,4 +24,4 @@ spec:
hostPath:
path: "{{PATH}}"
restartPolicy: Never
- #backoffLimit: 4 \ No newline at end of file
+ #backoffLimit: 4