summaryrefslogtreecommitdiffstats
path: root/csit/resources/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'csit/resources/scripts')
-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
3 files changed, 42 insertions, 43 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