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
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -158,10 +158,12 @@ function crdb_undeploy_single() {

function crdb_drop_database_single() {
    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}')
    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}"
    kubectl exec -it --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \
        ./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \
+2 −3
Original line number Diff line number Diff line
@@ -160,13 +160,12 @@ function qdb_undeploy() {
}

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}')
    echo "QDB_HOST=${QDB_HOST}"
    QDB_PORT=$(kubectl --namespace ${QDB_NAMESPACE} get service questdb-public -o 'jsonpath={.spec.ports[?(@.name=="http")].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}+;"
    echo
    curl "http://${QDB_HOST}:${QDB_PORT}/exec?fmt=json&query=DROP+TABLE+IF+EXISTS+${QDB_TABLE_SLICE_GROUPS}+;"
+3 −3
Original line number Diff line number Diff line
@@ -370,11 +370,11 @@ for COMPONENT in $TFS_COMPONENTS; do
    COMPONENT_OBJNAME=$(echo "${COMPONENT}" | sed "s/\_/-/")
    kubectl wait --namespace $TFS_K8S_NAMESPACE \
        --for='condition=available' --timeout=90s deployment/${COMPONENT_OBJNAME}service
    WAIT_EXIT_CODE=$!
    WAIT_EXIT_CODE=$?
    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
        exit $exit_code
        exit $WAIT_EXIT_CODE
    fi
    printf "\n"
done
+1 −1
Original line number Diff line number Diff line
@@ -46,4 +46,4 @@ end2end ofc22:
  artifacts:
      when: always
      reports:
        junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report.xml
        junit: src/tests/${TEST_NAME}/report*.xml
+16 −2
Original line number Diff line number Diff line
@@ -26,10 +26,18 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui"
# Uncomment to activate Monitoring
export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"

# Uncomment to activate ZTP and Policy Manager
#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp policy"
# Uncomment to activate BGP-LS Speaker
#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"

# Uncomment to activate Policy Manager
#export TFS_COMPONENTS="${TFS_COMPONENTS} policy"

# Uncomment to activate Optical CyberSecurity
#export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager"

@@ -39,6 +47,12 @@ export TFS_COMPONENTS="${TFS_COMPONENTS} ztp"
# Uncomment to activate 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.
export TFS_IMAGE_TAG="dev"