Add the moon_pythonfunctest container to perform functionnal tests 01/52101/2
authorfrancois.cellier <francois.cellier@orange.com>
Tue, 13 Feb 2018 12:06:51 +0000 (13:06 +0100)
committerfrancois.cellier <francois.cellier@orange.com>
Tue, 13 Feb 2018 16:01:47 +0000 (17:01 +0100)
Change-Id: I2be863862ce7df408f759664b10af45416b3d712

moon_forming/Dockerfile
moon_forming/switch.sh [deleted file]
moon_manager/tests/functional_pod/test_models.py
moon_pythonfunctest/Dockerfile [new file with mode: 0644]
moon_pythonfunctest/README.md [new file with mode: 0644]
moon_pythonfunctest/run_func_test.sh [new file with mode: 0755]
moon_pythonunittest/run_tests.sh
tests/functional/run_tests_for_component.sh
tools/moon_kubernetes/conf/moon.conf
tools/moon_kubernetes/templates/moon_functest.yaml [moved from tools/moon_kubernetes/templates/moon_forming_functest.yaml with 79% similarity]

index 74616c8..ffae02c 100644 (file)
@@ -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 (file)
index adb1ebe..0000000
+++ /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
index dcda9f3..8b4ceef 100644 (file)
@@ -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 (file)
index 0000000..8ae093b
--- /dev/null
@@ -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 (file)
index 0000000..e2a4d14
--- /dev/null
@@ -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 (executable)
index 0000000..acd0e1e
--- /dev/null
@@ -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>"
+
index 6c586f8..8175d00 100644 (file)
@@ -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 .
index fd9ab7f..6c6a033 100644 (file)
@@ -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}
 
index 28ad7a8..e242125 100644 (file)
@@ -67,7 +67,7 @@ logging:
   handlers:
     console:
       class : logging.StreamHandler
-      formatter: brief
+      formatter: custom
       level   : INFO
       stream  : ext://sys.stdout
     file:
@@ -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