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

Pre-merge code cleanup

parent fa52178f
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!268Resolve "(OPT) Integrate QKD tests in TFS CI/CD pipeline"
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"
# Set the list of components, separated by spaces, you want to build images for, and deploy. # Set the list of components, separated by spaces, you want to build images for, and deploy.
#export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator"
export TFS_COMPONENTS="context device pathcomp service slice nbi webui"
# Uncomment to activate Monitoring (old) # Uncomment to activate Monitoring (old)
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
...@@ -75,11 +74,11 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui" ...@@ -75,11 +74,11 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui"
# To manage QKD Apps, "service" requires "qkd_app" to be deployed # To manage QKD Apps, "service" requires "qkd_app" to be deployed
# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the # before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the
# "qkd_app" only if "service" is already in TFS_COMPONENTS, and re-export it. # "qkd_app" only if "service" is already in TFS_COMPONENTS, and re-export it.
if [[ "$TFS_COMPONENTS" == *"service"* ]]; then #if [[ "$TFS_COMPONENTS" == *"service"* ]]; then
BEFORE="${TFS_COMPONENTS% service*}" # BEFORE="${TFS_COMPONENTS% service*}"
AFTER="${TFS_COMPONENTS#* service}" # AFTER="${TFS_COMPONENTS#* service}"
export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}" # export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}"
fi #fi
# Set the tag you want to use for your images. # Set the tag you want to use for your images.
......
...@@ -38,29 +38,29 @@ build device: ...@@ -38,29 +38,29 @@ build device:
- manifests/${IMAGE_NAME}service.yaml - manifests/${IMAGE_NAME}service.yaml
- .gitlab-ci.yml - .gitlab-ci.yml
# Start Mock QKD Nodes before unit testing ## Start Mock QKD Nodes before unit testing
start_mock_nodes: #start_mock_nodes:
stage: deploy # stage: deploy
script: # script:
- bash src/tests/tools/mock_qkd_nodes/start.sh & # - bash src/tests/tools/mock_qkd_nodes/start.sh &
- sleep 10 # wait for nodes to spin up # - sleep 10 # wait for nodes to spin up
artifacts: # artifacts:
paths: # paths:
- mock_nodes.log # - mock_nodes.log
rules: # rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' # - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' # - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
# Prepare Scenario (Start NBI, mock services) ## Prepare Scenario (Start NBI, mock services)
prepare_scenario: #prepare_scenario:
stage: deploy # stage: deploy
script: # script:
- pytest src/tests/qkd/unit/PrepareScenario.py # - pytest src/tests/qkd/unit/PrepareScenario.py
needs: # needs:
- start_mock_nodes # - start_mock_nodes
rules: # rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' # - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' # - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
# Apply unit test to the component # Apply unit test to the component
unit_test device: unit_test device:
...@@ -70,8 +70,8 @@ unit_test device: ...@@ -70,8 +70,8 @@ unit_test device:
stage: unit_test stage: unit_test
needs: needs:
- build device - build device
- start_mock_nodes #- start_mock_nodes
- prepare_scenario #- prepare_scenario
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- > - >
...@@ -94,7 +94,7 @@ unit_test device: ...@@ -94,7 +94,7 @@ unit_test device:
- docker logs $IMAGE_NAME - docker logs $IMAGE_NAME
- docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_emulated.py --junitxml=/opt/results/${IMAGE_NAME}_report_emulated.xml" - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_emulated.py --junitxml=/opt/results/${IMAGE_NAME}_report_emulated.xml"
- docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_ietf_actn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_actn.xml" - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_ietf_actn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_actn.xml"
- docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/qkd/unit/test_*.py" #- docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/qkd/unit/test_*.py"
- docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" - docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
after_script: after_script:
......
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import requests import requests
QKD_ADDRESS = '10.0.2.10' QKD_ADDRESS = '10.0.2.10'
......
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