Skip to content
Snippets Groups Projects
Commit f0130900 authored by Alberto Gonzalez Barneo's avatar Alberto Gonzalez Barneo
Browse files

Fixed some error

parent 53bcd0e6
No related branches found
No related tags found
1 merge request!273Draft: Resolve "(OPT) Integrate QKD tests in TFS CI/CD pipeline"
......@@ -49,6 +49,7 @@ unit_test service:
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create --driver=bridge teraflowbridge; fi
- pip install flask
- |
# Context-related cleanup
if docker container ls | grep crdb; then docker rm -f crdb; else echo "CockroachDB container is not in the system"; fi
......@@ -151,8 +152,9 @@ unit_test service:
docker logs $IMAGE_NAME
# Mock QKD Nodes Deployment
- echo "Starting stage: deploy_mock_nodes"
- pip install flask # Install Flask to ensure it is available
- |
echo "Starting stage: deploy_mock_nodes"
for port in 11111 22222 33333; do
if lsof -i:$port >/dev/null 2>&1; then
echo "Freeing up port $port..."
......@@ -162,7 +164,7 @@ unit_test service:
MOCK_NODES_DIR="$PWD/src/tests/tools/mock_qkd_nodes"
if [ -d "$MOCK_NODES_DIR" ]; then
cd "$MOCK_NODES_DIR" || exit
./start.sh &
./start.sh & # The start script that invokes flask commands
MOCK_NODES_PID=$!
else
echo "Error: Mock QKD nodes directory '$MOCK_NODES_DIR' not found."
......
......@@ -32,6 +32,9 @@ RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade setuptools wheel
RUN python3 -m pip install --upgrade pip-tools
# Install Flask
RUN python3 -m pip install Flask
# Get common Python packages
# Note: this step enables sharing the previous Docker build steps among all the Python components
WORKDIR /var/teraflow
......
......@@ -13,30 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
cd "$(dirname "$0")"
# Function to kill all background processes
killbg() {
for p in "${pids[@]}" ; do
kill "$p";
for p in "${pids[@]}"; do
kill "$p" 2>/dev/null
done
}
# Trap exit and ensure cleanup of Flask processes
trap killbg EXIT
pids=()
# Set FLASK_APP and run the Flask instances on different ports
export FLASK_APP=wsgi
flask run --host 0.0.0.0 --port 11111 &
pids+=($!)
flask run --host 0.0.0.0 --port 22222 &
pids+=($!)
flask run --host 0.0.0.0 --port 33333 &
pids+=($!)
# Starting Flask instances on different ports
for port in 11111 22222 33333; do
flask run --host 0.0.0.0 --port "$port" &
pids+=($!)
sleep 2 # To avoid conflicts during startup, giving each Flask instance time to initialize
done
# Wait for all background processes to finish
wait
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