diff options
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/README.md | 27 | ||||
-rw-r--r-- | tests/functional/run_tests.sh | 13 | ||||
-rw-r--r-- | tests/functional/run_tests_for_component.sh | 27 |
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/functional/README.md b/tests/functional/README.md new file mode 100644 index 00000000..4cac22b6 --- /dev/null +++ b/tests/functional/README.md @@ -0,0 +1,27 @@ +# Moon Functional Test + +[Test Platform Setup](../../tools/moon_kubernetes/README.md) + + +### Pod Functional Test +Launch functional [test scenario](tests/functional/scenario_enabled) : +```bash +sudo pip install python_moonclient --upgrade +cd $MOON_HOME/tests/functional/scenario_tests +moon_create_pdp --consul-host=$MOON_HOST --consul-port=30005 -v rbac_large.py +moon_get_keystone_project --consul-host=$MOON_HOST --consul-port=30005 +moon_get_pdp --consul-host=$MOON_HOST --consul-port=30005 +moon_map_pdp_to_project "<pdp_id>" "<keystone_project_id>" +moon_send_authz_to_wrapper --consul-host=$MOON_HOST --consul-port=30005 --authz-host=$WRAPPER_HOST --authz-port=$WRAPPER_PORT -v rbac_large.py +``` + +To retrieve the wrapper information, use the following command: +```bash +kubectl get -n moon services | grep wrapper +``` + +Launch functional tests: +```bash +cd $MOON_HOME +sudo bash $TARGET_MODULE/tests/functional_pod/run_functional_tests.sh +``` diff --git a/tests/functional/run_tests.sh b/tests/functional/run_tests.sh new file mode 100644 index 00000000..c5cbabbb --- /dev/null +++ b/tests/functional/run_tests.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +echo "starting Moon Functional Tests" + +COMPONENTS="moon_authz, moon_interface, moon_manager, moon_orchestrator, moon_wrapper" + +for dir in ${COMPONENTS}; do + echo "Testing component ${dir}" + cd ${MOON_HOME}/${dir} + docker run --rm --volume $(pwd):/data wukongsun/moon_forming:latest /bin/bash /root/switch.sh functest +done + +# TODO: download tests results diff --git a/tests/functional/run_tests_for_component.sh b/tests/functional/run_tests_for_component.sh new file mode 100644 index 00000000..fd9ab7fa --- /dev/null +++ b/tests/functional/run_tests_for_component.sh @@ -0,0 +1,27 @@ +#!/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 + +echo current working directory: ${CUR_PWD} + +cat ${INPUT_FILE} | sed "s|{{PATH}}|${CUR_PWD}|" > ${OUTPUT_FILE} + +kubectl create -f ${OUTPUT_FILE} + +sleep 5 +kubectl get -n moon jobs +echo OUTPUT is $? +if [ "$?" -ne 0 ] +then + sleep 5 + kubectl get -n moon jobs +fi + +echo "waiting for FuncTests (it may takes time)..." +echo -e "\033[35m" +sed '/<END OF JOB>/q' <(kubectl logs -n moon jobs/functest -f) +echo -e "\033[m" + +kubectl delete -f ${OUTPUT_FILE} |