summaryrefslogtreecommitdiffstats
path: root/csit/resources
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-12-19 09:45:08 +0000
committeradheli.tavares <adheli.tavares@est.tech>2025-01-10 11:47:16 +0000
commit7a6c3faeb0134776d46352f51f02cf6b2aef72b7 (patch)
treee9fcbc4e1ad8ca7c0ad32b780402f59803801a24 /csit/resources
parentff37c033e7c25e1dd4ab6a1cc5b3913d27a37b0b (diff)
General improvements on CSIT scripts
- some issues with functions order - clear waiting times for docker containers to come up - --local flag added to make it easier to run tests with local images Issue-ID: POLICY-5239 Change-Id: I3bcbfd88f45110436b2b0fda16c61936ef919f95 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'csit/resources')
-rwxr-xr-xcsit/resources/scripts/build-csit-docker-image.sh3
-rwxr-xr-xcsit/resources/scripts/get-cluster-info.sh76
-rwxr-xr-xcsit/resources/scripts/wait_for_rest.sh6
-rw-r--r--csit/resources/tests/apex-slas-3.robot6
4 files changed, 45 insertions, 46 deletions
diff --git a/csit/resources/scripts/build-csit-docker-image.sh b/csit/resources/scripts/build-csit-docker-image.sh
index c80afc4f..8b5aa7d6 100755
--- a/csit/resources/scripts/build-csit-docker-image.sh
+++ b/csit/resources/scripts/build-csit-docker-image.sh
@@ -1,6 +1,6 @@
#!/bin/bash -x
#
-# Copyright 2024 Nordix Foundation.
+# Copyright 2024-2025 Nordix Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@ fi
GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE}"/.gitreview)
export ROBOT_DOCKER_IMAGE="policy-csit-robot"
-echo "Build docker image for robot framework"
cd ${WORKSPACE}/csit/resources || exit
docker image rm -f ${ROBOT_DOCKER_IMAGE}
diff --git a/csit/resources/scripts/get-cluster-info.sh b/csit/resources/scripts/get-cluster-info.sh
index 92e92ee8..75fe7193 100755
--- a/csit/resources/scripts/get-cluster-info.sh
+++ b/csit/resources/scripts/get-cluster-info.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# ============LICENSE_START=======================================================
-# Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
+# Copyright (C) 2023-2025 Nordix Foundation. All rights reserved.
# Modifications Copyright © 2024 Deutsche Telekom
# ================================================================================
#
@@ -39,6 +39,10 @@ export OPA_PORT=30012
export SIMULATOR_PORT=30904
# Retrieve pod names
+function get_pod_name() {
+ microk8s kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1
+}
+
function get_pod_names() {
export APEX_POD=$(get_pod_name apex)
export PAP_POD=$(get_pod_name pap)
@@ -56,6 +60,10 @@ function get_pod_names() {
}
# Retrieve service names
+function get_svc_name() {
+ microk8s kubectl get svc --no-headers -o custom-columns=':metadata.name' | grep $1
+}
+
function get_svc_names() {
export APEX_SVC=$(get_svc_name policy-apex-pdp)
export PAP_SVC=$(get_svc_name policy-pap)
@@ -72,47 +80,11 @@ function get_svc_names() {
export POLICY_K8S_SVC=$(get_svc_name policy-clamp-ac-k8s-ppnt)
}
-# Expose services in order to perform tests from JMeter
-function expose_services() {
- expose_service $APEX_SVC
- expose_service $PAP_SVC
- expose_service $API_SVC
- expose_service $XACML_SVC
- expose_service_opa_pdp $OPA_SVC
- expose_service $DROOLS_SVC
- expose_service $DIST_SVC
- expose_service $ACM_SVC
- expose_service $POLICY_PPNT_SVC
- expose_service $POLICY_HTTP_SVC
- expose_service $POLICY_SIM_SVC
- expose_service $POLICY_K8S_SVC
-
- setup_message_router_svc
- sleep 2
- patch_ports
-}
-
-function get_pod_name() {
- microk8s kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1
-}
-
-function get_svc_name() {
- microk8s kubectl get svc --no-headers -o custom-columns=':metadata.name' | grep $1
-}
-
-function expose_service_opa_pdp() {
- microk8s kubectl expose service $1 --name $1"-svc" --type NodePort --protocol TCP --port 8282 --target-port 8282
-}
-
-function expose_service() {
- microk8s kubectl expose service $1 --name $1"-svc" --type NodePort --protocol TCP --port 6969 --target-port 6969
-}
-
+# Assign set port values
function patch_port() {
microk8s kubectl patch service "$1-svc" --namespace=default --type='json' --patch='[{"op": "replace", "path": "/spec/ports/0/nodePort", "value":'"$2"'}]'
}
-# Assign set port values
function patch_ports() {
patch_port "$APEX_SVC" $APEX_PORT
patch_port "$API_SVC" $API_PORT
@@ -133,6 +105,34 @@ function setup_message_router_svc() {
microk8s kubectl patch service message-router-svc --namespace=default --type='json' --patch='[{"op": "replace", "path": "/spec/ports/0/nodePort", "value":'"$SIMULATOR_PORT"'}]'
}
+# Expose services in order to perform tests from JMeter
+function expose_service() {
+ microk8s kubectl expose service $1 --name $1"-svc" --type NodePort --protocol TCP --port 6969 --target-port 6969
+}
+
+function expose_service_opa_pdp() {
+ microk8s kubectl expose service $1 --name $1"-svc" --type NodePort --protocol TCP --port 8282 --target-port 8282
+}
+
+function expose_services() {
+ expose_service $APEX_SVC
+ expose_service $PAP_SVC
+ expose_service $API_SVC
+ expose_service $XACML_SVC
+ expose_service $DROOLS_SVC
+ expose_service $DIST_SVC
+ expose_service $ACM_SVC
+ expose_service $POLICY_PPNT_SVC
+ expose_service $POLICY_HTTP_SVC
+ expose_service $POLICY_SIM_SVC
+ expose_service $POLICY_K8S_SVC
+ expose_service_opa_pdp $OPA_SVC
+
+ setup_message_router_svc
+ sleep 2
+ patch_ports
+}
+
####MAIN###
get_pod_names
get_svc_names
diff --git a/csit/resources/scripts/wait_for_rest.sh b/csit/resources/scripts/wait_for_rest.sh
index 9732bc54..b51a7fe0 100755
--- a/csit/resources/scripts/wait_for_rest.sh
+++ b/csit/resources/scripts/wait_for_rest.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# ============LICENSE_START====================================================
-# Copyright (C) 2023-2024 Nordix Foundation.
+# Copyright (C) 2023-2025 Nordix Foundation.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ do
export port="$2"
shift
shift
- echo "Waiting for REST to come up on $host port $port..."
+ echo "Checking if REST port $port is open on $host ..."
while [ "$tmout" -gt 0 ]
do
if command -v docker > /dev/null 2>&1
@@ -67,7 +67,7 @@ do
fi
done
if [ $rc -ne 0 ]; then
- echo "$host port $port REST cannot be detected"
+ echo "REST port $port cannot be detected on host $host"
exit $rc
fi
done
diff --git a/csit/resources/tests/apex-slas-3.robot b/csit/resources/tests/apex-slas-3.robot
index 1ceb9b77..c8fc2582 100644
--- a/csit/resources/tests/apex-slas-3.robot
+++ b/csit/resources/tests/apex-slas-3.robot
@@ -17,7 +17,7 @@ Healthcheck
Set Suite Variable ${pdpName} ${resp.json()['name']}
ValidatePolicyExecutionAndEventRateLowComplexity
- [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 30 events triggered per second
+ [Documentation] Validate that a moderate complexity policy can be executed in less than 100ms and minimum 30 events triggered per second
Set Test Variable ${policyName} onap.policies.apex.pnf.Test
${postjson}= Get File ${CURDIR}/data/${policyName}.json
CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0
@@ -31,7 +31,7 @@ ValidatePolicyExecutionAndEventRateLowComplexity
ValidateEventExecution ${eventStartTime} ${eventEndTime} 30
ValidatePolicyExecutionAndEventRateHighComplexity
- [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.6 events triggered per second
+ [Documentation] Validate that a high complexity policy can be executed in less than 5000ms and minimum 0.6 events triggered per second
Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test
${postjson}= Get File ${CURDIR}/data/${policyName}.json
CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0
@@ -47,7 +47,7 @@ ValidatePolicyExecutionAndEventRateHighComplexity
ValidateEventExecution ${eventStartTime} ${eventEndTime} 0.6
ValidatePolicyExecutionAndEventRateModerateComplexity
- [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 3 events triggered per second
+ [Documentation] Validate that a low complexity policy can be executed in less than 1000ms and minimum 3 events triggered per second
Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain
${postjson}= Get File ${CURDIR}/data/${policyName}.json
CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0