Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
84c8e985
Commit
84c8e985
authored
6 months ago
by
Alberto Gonzalez Barneo
Browse files
Options
Downloads
Patches
Plain Diff
Fixed wrong identation
parent
50476c75
No related branches found
Branches containing commit
No related tags found
1 merge request
!273
Draft: Resolve "(OPT) Integrate QKD tests in TFS CI/CD pipeline"
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/service/.gitlab-ci.yml
+44
-44
44 additions, 44 deletions
src/service/.gitlab-ci.yml
with
44 additions
and
44 deletions
src/service/.gitlab-ci.yml
+
44
−
44
View file @
84c8e985
...
...
@@ -48,28 +48,28 @@ unit_test service:
-
build 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"
;
echo "teraflowbridge is already created"
else
docker network create --driver=bridge teraflowbridge
;
docker network create --driver=bridge teraflowbridge
fi
-
>
-
|
# Context-related cleanup
if docker container ls | grep crdb; then docker rm -f crdb;
else echo "CockroachDB container is not in the system";
fi
;
if docker volume ls | grep crdb; then docker volume rm -f crdb;
else echo "CockroachDB volume is not in the system";
fi
;
if docker container ls | grep nats; then docker rm -f nats;
else echo "NATS container is not in the system";
fi
-
>
if docker container ls | grep crdb; then docker rm -f crdb; fi
if docker volume ls | grep crdb; then docker volume rm -f crdb; fi
if docker container ls | grep nats; then docker rm -f nats; fi
-
|
# Device-related cleanup
if docker container ls | grep context; then docker rm -f context;
else echo "context image is not in the system";
fi
;
if docker container ls | grep device; then docker rm -f device;
else echo "device image is not in the system";
fi
-
>
if docker container ls | grep context; then docker rm -f context; fi
if docker container ls | grep device; then docker rm -f device; fi
-
|
# Pathcomp-related cleanup
if docker container ls | grep pathcomp-frontend; then docker rm -f pathcomp-frontend;
else echo "pathcomp-frontend image is not in the system";
fi
;
if docker container ls | grep pathcomp-backend; then docker rm -f pathcomp-backend;
else echo "pathcomp-backend image is not in the system";
fi
-
>
if docker container ls | grep pathcomp-frontend; then docker rm -f pathcomp-frontend; fi
if docker container ls | grep pathcomp-backend; then docker rm -f pathcomp-backend; fi
-
|
# Service-related cleanup
if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME;
else echo "$IMAGE_NAME image is not in the system";
fi
if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; fi
script
:
-
docker pull "cockroachdb/cockroach:latest-v22.2"
-
docker pull "nats:2.9"
...
...
@@ -78,14 +78,14 @@ unit_test service:
-
docker pull "$CI_REGISTRY_IMAGE/pathcomp-frontend:$IMAGE_TAG"
-
docker pull "$CI_REGISTRY_IMAGE/pathcomp-backend:$IMAGE_TAG"
-
docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG"
-
>
-
|
# Context preparation
docker volume create crdb
;
docker volume create crdb
docker run --name crdb -d --network=teraflowbridge -p 26257:26257 -p 8080:8080 \
--env COCKROACH_DATABASE=tfs_test --env COCKROACH_USER=tfs --env COCKROACH_PASSWORD=tfs123 \
--volume "crdb:/cockroach/cockroach-data" \
cockroachdb/cockroach:latest-v22.2 start-single-node
-
>
-
|
docker run --name nats -d --network=teraflowbridge -p 4222:4222 -p 8222:8222 \
nats:2.9 --http_port 8222 --user tfs --pass tfs123
-
echo "Waiting for initialization..."
...
...
@@ -95,7 +95,7 @@ unit_test service:
-
NATS_ADDRESS=$(docker inspect nats --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}")
-
echo "CRDB Address
:
$CRDB_ADDRESS"
-
echo "NATS Address
:
$NATS_ADDRESS"
-
>
-
|
docker run --name context -d -p 1010:1010 \
--env "CRDB_URI=cockroachdb://tfs:tfs123@${CRDB_ADDRESS}:26257/tfs_test?sslmode=require" \
--env "MB_BACKEND=nats" \
...
...
@@ -104,7 +104,7 @@ unit_test service:
$CI_REGISTRY_IMAGE/context:$IMAGE_TAG
-
CONTEXTSERVICE_SERVICE_HOST=$(docker inspect context --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}")
-
echo "Context Service Host
:
$CONTEXTSERVICE_SERVICE_HOST"
-
>
-
|
# Device preparation
docker run --name device -d -p 2020:2020 \
--env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" \
...
...
@@ -112,14 +112,14 @@ unit_test service:
$CI_REGISTRY_IMAGE/device:$IMAGE_TAG
-
DEVICESERVICE_SERVICE_HOST=$(docker inspect device --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}")
-
echo "Device Service Host
:
$DEVICESERVICE_SERVICE_HOST"
-
>
-
|
# PathComp preparation
docker run --name pathcomp-backend -d -p 8081:8081 \
--network=teraflowbridge \
$CI_REGISTRY_IMAGE/pathcomp-backend:$IMAGE_TAG
-
PATHCOMP_BACKEND_HOST=$(docker inspect pathcomp-backend --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}")
-
echo "PathComp Backend Host
:
$PATHCOMP_BACKEND_HOST"
-
>
-
|
docker run --name pathcomp-frontend -d -p 10020:10020 \
--env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" \
--env "PATHCOMP_BACKEND_HOST=${PATHCOMP_BACKEND_HOST}" \
...
...
@@ -129,7 +129,7 @@ unit_test service:
-
sleep
5
-
PATHCOMPSERVICE_SERVICE_HOST=$(docker inspect pathcomp-frontend --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}")
-
echo "PathComp Frontend Host
:
$PATHCOMPSERVICE_SERVICE_HOST"
-
>
-
|
# Service preparation
docker run --name $IMAGE_NAME -d -p 3030:3030 \
--env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" \
...
...
@@ -145,49 +145,49 @@ unit_test service:
-
docker logs pathcomp-frontend
-
docker logs pathcomp-backend
-
docker logs $IMAGE_NAME
-
>
-
|
# Run the tests
docker exec -i $IMAGE_NAME bash -c \
"coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/opt/results/${IMAGE_NAME}_report.xml"
-
docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
-
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..."
;
fuser -k $port/tcp
;
fi
;
echo "Freeing up port $port..."
fuser -k $port/tcp
fi
done
-
MOCK_NODES_DIR="$PWD/src/tests/tools/mock_qkd_nodes"
-
>
-
|
if [ -d "$MOCK_NODES_DIR" ]; then
cd "$MOCK_NODES_DIR" || exit
;
./start.sh &
;
MOCK_NODES_PID=$!
;
cd "$MOCK_NODES_DIR" || exit
./start.sh &
MOCK_NODES_PID=$!
else
echo "Error: Mock QKD nodes directory '$MOCK_NODES_DIR' not found."
;
exit 1
;
echo "Error: Mock QKD nodes directory '$MOCK_NODES_DIR' not found."
exit 1
fi
-
echo "Waiting for mock nodes to be up..."
-
RETRY_COUNT=0
-
MAX_RETRIES=15
-
>
-
|
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if curl -s http://127.0.0.1:11111 > /dev/null && \
curl -s http://127.0.0.1:22222 > /dev/null && \
curl -s http://127.0.0.1:33333 > /dev/null; then
echo "Mock nodes are up!"
;
break
;
echo "Mock nodes are up!"
break
else
echo "Mock nodes not ready, retrying in 5 seconds..."
;
RETRY_COUNT=$((RETRY_COUNT + 1))
;
sleep 5
;
fi
;
echo "Mock nodes not ready, retrying in 5 seconds..."
RETRY_COUNT=$((RETRY_COUNT + 1))
sleep 5
fi
done
-
>
-
|
if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then
echo "Error: Mock nodes failed to start after multiple attempts."
;
exit 1
;
echo "Error: Mock nodes failed to start after multiple attempts."
exit 1
fi
-
docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose service/tests/qkd/test_functional_bootstrap.py"
coverage
:
'
/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment