Commit 5d2d4546 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code cleanup

parent fa52178f
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -20,8 +20,7 @@
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"

# 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"
export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator"

# Uncomment to activate Monitoring (old)
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
@@ -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
#   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.
if [[ "$TFS_COMPONENTS" == *"service"* ]]; then
    BEFORE="${TFS_COMPONENTS% service*}"
    AFTER="${TFS_COMPONENTS#* service}"
    export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}"
fi
#if [[ "$TFS_COMPONENTS" == *"service"* ]]; then
#    BEFORE="${TFS_COMPONENTS% service*}"
#    AFTER="${TFS_COMPONENTS#* service}"
#    export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}"
#fi


# Set the tag you want to use for your images.
+25 −25
Original line number Diff line number Diff line
@@ -38,29 +38,29 @@ build device:
      - manifests/${IMAGE_NAME}service.yaml
      - .gitlab-ci.yml

# Start Mock QKD Nodes before unit testing
start_mock_nodes:
  stage: deploy
  script:
    - bash src/tests/tools/mock_qkd_nodes/start.sh &
    - sleep 10 # wait for nodes to spin up
  artifacts:
    paths:
      - mock_nodes.log
  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 == "push" && $CI_COMMIT_BRANCH == "develop"'
## Start Mock QKD Nodes before unit testing
#start_mock_nodes:
#  stage: deploy
#  script:
#    - bash src/tests/tools/mock_qkd_nodes/start.sh &
#    - sleep 10 # wait for nodes to spin up
#  artifacts:
#    paths:
#      - mock_nodes.log
#  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 == "push" && $CI_COMMIT_BRANCH == "develop"'

# Prepare Scenario (Start NBI, mock services)
prepare_scenario:
  stage: deploy
  script:
    - pytest src/tests/qkd/unit/PrepareScenario.py
  needs:
    - start_mock_nodes
  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 == "push" && $CI_COMMIT_BRANCH == "develop"'
## Prepare Scenario (Start NBI, mock services)
#prepare_scenario:
#  stage: deploy
#  script:
#    - pytest src/tests/qkd/unit/PrepareScenario.py
#  needs:
#    - start_mock_nodes
#  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 == "push" && $CI_COMMIT_BRANCH == "develop"'

# Apply unit test to the component
unit_test device:
@@ -70,8 +70,8 @@ unit_test device:
  stage: unit_test
  needs:
    - build device
    - start_mock_nodes
    - prepare_scenario
    #- start_mock_nodes
    #- prepare_scenario
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
    - >
@@ -94,7 +94,7 @@ unit_test device:
    - 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_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"
  coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
  after_script:
+14 −0
Original line number Diff line number Diff line
# 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

QKD_ADDRESS = '10.0.2.10'