Skip to content
Snippets Groups Projects
Commit 76d28c7f authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Fix CI/CD pipeline - end-to-end automated tests

parent 7f5389d5
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!216Resolve "Automate end-to-end tests and integrate them in CI/CD pipeline"
...@@ -158,10 +158,12 @@ function crdb_undeploy_single() { ...@@ -158,10 +158,12 @@ function crdb_undeploy_single() {
function crdb_drop_database_single() { function crdb_drop_database_single() {
echo "Drop database if exists" echo "Drop database if exists"
kubectl --namespace ${CRDB_NAMESPACE} get service cockroachdb-public -o yaml #kubectl --namespace ${CRDB_NAMESPACE} get service cockroachdb-public -o yaml
CRDB_HOST_SQL=$(kubectl --namespace ${CRDB_NAMESPACE} get service cockroachdb-public -o 'jsonpath={.spec.clusterIP}')
echo "CRDB_HOST_SQL=${CRDB_HOST_SQL}"
CRDB_PORT_SQL=$(kubectl --namespace ${CRDB_NAMESPACE} get service cockroachdb-public -o 'jsonpath={.spec.ports[?(@.name=="sql")].port}') CRDB_PORT_SQL=$(kubectl --namespace ${CRDB_NAMESPACE} get service cockroachdb-public -o 'jsonpath={.spec.ports[?(@.name=="sql")].port}')
echo "CRDB_PORT_SQL=${CRDB_PORT_SQL}" echo "CRDB_PORT_SQL=${CRDB_PORT_SQL}"
CRDB_CLIENT_URL="postgresql://${CRDB_USERNAME}:${CRDB_PASSWORD}@cockroachdb-0:${CRDB_PORT_SQL}/defaultdb?sslmode=require" CRDB_CLIENT_URL="postgresql://${CRDB_USERNAME}:${CRDB_PASSWORD}@${CRDB_HOST_SQL}:${CRDB_PORT_SQL}/defaultdb?sslmode=require"
echo "CRDB_CLIENT_URL=${CRDB_CLIENT_URL}" echo "CRDB_CLIENT_URL=${CRDB_CLIENT_URL}"
kubectl exec -it --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \ kubectl exec -it --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \
./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \ ./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \
......
...@@ -160,13 +160,12 @@ function qdb_undeploy() { ...@@ -160,13 +160,12 @@ function qdb_undeploy() {
} }
function qdb_drop_tables() { function qdb_drop_tables() {
kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o yaml echo "Drop tables, if exist"
#kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o yaml
QDB_HOST=$(kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o 'jsonpath={.spec.clusterIP}') QDB_HOST=$(kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o 'jsonpath={.spec.clusterIP}')
echo "QDB_HOST=${QDB_HOST}" echo "QDB_HOST=${QDB_HOST}"
QDB_PORT=$(kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o 'jsonpath={.spec.ports[?(@.name=="http")].port}') QDB_PORT=$(kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o 'jsonpath={.spec.ports[?(@.name=="http")].port}')
echo "QDB_PORT=${QDB_PORT}" echo "QDB_PORT=${QDB_PORT}"
echo "Drop tables, if exist"
curl "http://${QDB_HOST}:${QDB_PORT}/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+${QDB_TABLE_MONITORING_KPIS}+;" curl "http://${QDB_HOST}:${QDB_PORT}/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+${QDB_TABLE_MONITORING_KPIS}+;"
echo echo
curl "http://${QDB_HOST}:${QDB_PORT}/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+${QDB_TABLE_SLICE_GROUPS}+;" curl "http://${QDB_HOST}:${QDB_PORT}/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+${QDB_TABLE_SLICE_GROUPS}+;"
......
...@@ -370,11 +370,11 @@ for COMPONENT in $TFS_COMPONENTS; do ...@@ -370,11 +370,11 @@ for COMPONENT in $TFS_COMPONENTS; do
COMPONENT_OBJNAME=$(echo "${COMPONENT}" | sed "s/\_/-/") COMPONENT_OBJNAME=$(echo "${COMPONENT}" | sed "s/\_/-/")
kubectl wait --namespace $TFS_K8S_NAMESPACE \ kubectl wait --namespace $TFS_K8S_NAMESPACE \
--for='condition=available' --timeout=90s deployment/${COMPONENT_OBJNAME}service --for='condition=available' --timeout=90s deployment/${COMPONENT_OBJNAME}service
WAIT_EXIT_CODE=$! WAIT_EXIT_CODE=$?
if [[ $WAIT_EXIT_CODE != 0 ]]; then if [[ $WAIT_EXIT_CODE != 0 ]]; then
echo " Failed to deploy '$COMPONENT' component, exiting..." echo " Failed to deploy '${COMPONENT}' component, exit code '${WAIT_EXIT_CODE}', exiting..."
kubectl logs --namespace $TFS_K8S_NAMESPACE deployment/${COMPONENT_OBJNAME}service --all-containers=true kubectl logs --namespace $TFS_K8S_NAMESPACE deployment/${COMPONENT_OBJNAME}service --all-containers=true
exit $exit_code exit $WAIT_EXIT_CODE
fi fi
printf "\n" printf "\n"
done done
......
...@@ -46,4 +46,4 @@ end2end ofc22: ...@@ -46,4 +46,4 @@ end2end ofc22:
artifacts: artifacts:
when: always when: always
reports: reports:
junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report.xml junit: src/tests/${TEST_NAME}/report*.xml
...@@ -26,10 +26,18 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui" ...@@ -26,10 +26,18 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui"
# Uncomment to activate Monitoring # Uncomment to activate Monitoring
export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
# Uncomment to activate ZTP and Policy Manager # Uncomment to activate BGP-LS Speaker
#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp policy" #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker"
# Uncomment to activate Optical Controller
#export TFS_COMPONENTS="${TFS_COMPONENTS} opticalcontroller"
# Uncomment to activate ZTP
export TFS_COMPONENTS="${TFS_COMPONENTS} ztp" export TFS_COMPONENTS="${TFS_COMPONENTS} ztp"
# Uncomment to activate Policy Manager
#export TFS_COMPONENTS="${TFS_COMPONENTS} policy"
# Uncomment to activate Optical CyberSecurity # Uncomment to activate Optical CyberSecurity
#export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager" #export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager"
...@@ -39,6 +47,12 @@ export TFS_COMPONENTS="${TFS_COMPONENTS} ztp" ...@@ -39,6 +47,12 @@ export TFS_COMPONENTS="${TFS_COMPONENTS} ztp"
# Uncomment to activate TE # Uncomment to activate TE
#export TFS_COMPONENTS="${TFS_COMPONENTS} te" #export TFS_COMPONENTS="${TFS_COMPONENTS} te"
# Uncomment to activate Forecaster
#export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster"
# Uncomment to activate E2E Orchestrator
#export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator"
# Set the tag you want to use for your images. # Set the tag you want to use for your images.
export TFS_IMAGE_TAG="dev" export TFS_IMAGE_TAG="dev"
......
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