Skip to content
Snippets Groups Projects
Commit de12d580 authored by Julien Leduc's avatar Julien Leduc
Browse files

NAMESPACE environment variable is not needed anymore.

Now `run_systemtest.sh` can be used standalone, outside of CI environment.
parent 86569e5c
No related branches found
No related tags found
No related merge requests found
......@@ -92,8 +92,8 @@ ctageneric_docker_rename:
archiveretrieve:
stage: test
script:
- export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -s tests/systest.sh
- namespace="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
- cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${namespace} -p ${CI_PIPELINE_ID} -s tests/systest.sh
artifacts:
paths:
- pod_logs
......
......@@ -13,7 +13,7 @@ orchestration_dir=${PWD}
usage() { cat <<EOF 1>&2
Usage: $0 -s <systemtest_script> [-p <gitlab pipeline ID>]
Usage: $0 -n <namespace> -s <systemtest_script> [-p <gitlab pipeline ID>]
Create a kubernetes instance and launch the system test script specified.
Makes sure the created instance is cleaned up at the end and return the status of the system test.
......@@ -22,12 +22,22 @@ EOF
exit 1
}
while getopts "s:" o; do
# options that must be passed to create_instance
# always delete DB and OBJECTSTORE for tests
CREATE_OPTS="-D -O"
while getopts "n:s:p:" o; do
case "${o}" in
s)
systemtest_script=${OPTARG}
test -f ${systemtest_script} || error="${error}Objectstore configmap file ${config_objectstore} does not exist\n"
;;
n)
namespace=${OPTARG}
;;
p)
CREATE_OPTS="${CREATE_OPTS} -p ${OPTARG}"
;;
*)
usage
;;
......@@ -35,6 +45,12 @@ while getopts "s:" o; do
done
shift $((OPTIND-1))
if [ -z "${namespace}" ]; then
echo "a namespace is mandatory" 1>&2
usage
fi
if [ -z "${systemtest_script}" ]; then
echo "a systemtest script is mandatory" 1>&2
usage
......@@ -56,19 +72,19 @@ function execute_log {
if [ "${execute_log_rc}" != "0" ]; then
echo "FAILURE: cleaning up environment"
cd ${orchestration_dir}
./delete_instance.sh -n ${NAMESPACE}
./delete_instance.sh -n ${namespace}
exit 1
fi
}
# create instance
execute_log "./create_instance.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -D -O 2>&1" "${orchestration_dir}/../../create_instance.log"
execute_log "./create_instance.sh -n ${namespace} ${CREATE_OPTS} 2>&1" "${orchestration_dir}/../../create_instance.log"
# launch system test
cd $(dirname ${systemtest_script})
execute_log "./$(basename ${systemtest_script}) 2>&1" "${orchestration_dir}/../../systests.sh.log"
execute_log "./$(basename ${systemtest_script}) -n ${namespace} 2>&1" "${orchestration_dir}/../../systests.sh.log"
cd ${orchestration_dir}
# delete instance
./delete_instance.sh -n ${NAMESPACE}
./delete_instance.sh -n ${namespace}
exit $?
#!/bin/bash
#@param NAMESPACE must be defined outside
usage() { cat <<EOF 1>&2
Usage: $0 -n <namespace>
EOF
exit 1
}
while getopts "n:" o; do
case "${o}" in
n)
NAMESPACE=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${NAMESPACE}" ]; then
usage
fi
if [ ! -z "${error}" ]; then
echo -e "ERROR:\n${error}"
exit 1
fi
# eos instance identified by SSS username
EOSINSTANCE=ctaeos
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment