From b9333b2d333c661be4b9aaba5a294be42667a2a4 Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Tue, 8 Oct 2024 12:35:38 +0000 Subject: [PATCH] Pre-merge code cleanup --- my_deploy.sh | 2 +- src/qos_profile/.gitlab-ci.yml | 16 +--------------- src/qos_profile/tests/conftest.py | 2 +- src/qos_profile/tests/test_constraints.py | 2 +- src/qos_profile/tests/test_crud.py | 2 +- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/my_deploy.sh b/my_deploy.sh index 6d0a488c2..344ca44ee 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -20,7 +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 qos_profile" +export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" # Uncomment to activate Monitoring (old) #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" diff --git a/src/qos_profile/.gitlab-ci.yml b/src/qos_profile/.gitlab-ci.yml index f46d63856..0525e69b3 100644 --- a/src/qos_profile/.gitlab-ci.yml +++ b/src/qos_profile/.gitlab-ci.yml @@ -53,12 +53,10 @@ unit_test qos_profile: # QoSProfile-related - 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 $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME image is not in the system"; fi script: - docker pull "cockroachdb/cockroach:latest-v22.2" - - docker pull "nats:2.9" - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" # environment preparation @@ -68,26 +66,17 @@ unit_test qos_profile: --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..." - while ! docker logs crdb 2>&1 | grep -q 'finished creating default user \"tfs\"'; do sleep 1; done - docker logs crdb - - while ! docker logs nats 2>&1 | grep -q 'Server is ready'; do sleep 1; done - - docker logs nats - docker ps -a - CRDB_ADDRESS=$(docker inspect crdb --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}") - echo $CRDB_ADDRESS - - NATS_ADDRESS=$(docker inspect nats --format "{{.NetworkSettings.Networks.teraflowbridge.IPAddress}}") - - echo $NATS_ADDRESS - > # QoSProfile preparation - > docker run --name $IMAGE_NAME -d -p 3030:3030 --env "CRDB_URI=cockroachdb://tfs:tfs123@${CRDB_ADDRESS}:26257/tfs_test?sslmode=require" - --env "MB_BACKEND=nats" - --env "NATS_URI=nats://tfs:tfs123@${NATS_ADDRESS}:4222" --volume "$PWD/src/$IMAGE_NAME/tests:/opt/results" --network=teraflowbridge $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG @@ -108,10 +97,7 @@ unit_test qos_profile: # Check status after the tests - docker ps -a - docker logs $IMAGE_NAME - - - docker rm -f $IMAGE_NAME - - - docker rm -f $IMAGE_NAME crdb nats + - docker rm -f $IMAGE_NAME crdb - docker volume rm -f crdb - docker network rm teraflowbridge - docker volume prune --force diff --git a/src/qos_profile/tests/conftest.py b/src/qos_profile/tests/conftest.py index 7c8424e00..8983183f3 100644 --- a/src/qos_profile/tests/conftest.py +++ b/src/qos_profile/tests/conftest.py @@ -45,4 +45,4 @@ def create_qos_profile_from_json(qos_profile_data: dict) -> QoSProfile: qos_profile.packetDelayBudget.CopyFrom(create_QoSProfileValueUnitPair(qos_profile_data['packetDelayBudget'])) qos_profile.jitter.CopyFrom(create_QoSProfileValueUnitPair(qos_profile_data['jitter'])) qos_profile.packetErrorLossRate = qos_profile_data['packetErrorLossRate'] - return qos_profile \ No newline at end of file + return qos_profile diff --git a/src/qos_profile/tests/test_constraints.py b/src/qos_profile/tests/test_constraints.py index dd03ff7ae..78fe73d64 100644 --- a/src/qos_profile/tests/test_constraints.py +++ b/src/qos_profile/tests/test_constraints.py @@ -91,4 +91,4 @@ def test_get_constraints(qos_profile_client: QoSProfileClient): assert constraint_2.schedule.start_timestamp == 1726063284.25332 assert constraint_2.schedule.duration_days == 1 - qos_profile_client.DeleteQoSProfile(qos_profile.qos_profile_id) \ No newline at end of file + qos_profile_client.DeleteQoSProfile(qos_profile.qos_profile_id) diff --git a/src/qos_profile/tests/test_crud.py b/src/qos_profile/tests/test_crud.py index 1037f3849..9b92646c3 100644 --- a/src/qos_profile/tests/test_crud.py +++ b/src/qos_profile/tests/test_crud.py @@ -114,4 +114,4 @@ def test_failed_delete_qos_profiles(qos_profile_client: QoSProfileClient): def test_delete_qos_profiles(qos_profile_client: QoSProfileClient): qos_profile = create_qos_profile_from_json(qos_profile_data) qos_profiles_deleted = qos_profile_client.DeleteQoSProfile(qos_profile.qos_profile_id) - assert qos_profiles_deleted == Empty() \ No newline at end of file + assert qos_profiles_deleted == Empty() -- GitLab