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

Pre-merge code cleanup

parent 53ba0ee6
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!257Resolve "Create QoSProfile component"
......@@ -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"
......
......@@ -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
......
......@@ -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
......@@ -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)
......@@ -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()
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