From 6424f821b6a8e139d9ddefbeffe0dea42168a586 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Wed, 9 Aug 2023 16:08:56 +0100 Subject: Policy API/PAP Upgrade for Spring Actuator - fix the metrics response from upgrading actuator in policy api/pap Issue-ID: POLICY-4670 Change-Id: I29f15a4ee8279743dcdd02006d7c21864feb85a9 Signed-off-by: adheli.tavares --- compose/export-ports.sh | 3 +- compose/fixed-versions.sh | 57 +++++++++++++++++++++++++++++++++++++ compose/start-compose.sh | 2 +- csit/resources/tests/api-test.robot | 20 ++++++------- csit/resources/tests/pap-test.robot | 4 +-- 5 files changed, 71 insertions(+), 15 deletions(-) create mode 100755 compose/fixed-versions.sh diff --git a/compose/export-ports.sh b/compose/export-ports.sh index 5d64e1f9..701449e0 100755 --- a/compose/export-ports.sh +++ b/compose/export-ports.sh @@ -19,13 +19,12 @@ if $(docker images | grep -q "onap\/policy-api") then - CONTAINER_LOCATION=$( + export CONTAINER_LOCATION=$( docker images | grep onap/policy-api | head -1 | sed 's/onap\/policy-api.*$//' ) - export CONTAINER_LOCATION else export CONTAINER_LOCATION="nexus3.onap.org:10001/" fi diff --git a/compose/fixed-versions.sh b/compose/fixed-versions.sh new file mode 100755 index 00000000..af99f2b6 --- /dev/null +++ b/compose/fixed-versions.sh @@ -0,0 +1,57 @@ +#! /bin/bash + +# ============LICENSE_START==================================================== +# Copyright (C) 2023 Nordix Foundation. +# ============================================================================= +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== + +if [ -z "${WORKSPACE}" ]; then + WORKSPACE=$(git rev-parse --show-toplevel) + export WORKSPACE +fi + +GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) + +echo GERRIT_BRANCH="${GERRIT_BRANCH}" + +export POLICY_MARIADB_VER=10.10.2 +echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} + +export POLICY_POSTGRES_VER=11.1 +echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER} + +export POLICY_DOCKER_VERSION="3.0.1-SNAPSHOT" + +export POLICY_MODELS_VERSION="3.0.1-SNAPSHOT" + +export POLICY_API_VERSION="3.0.1-SNAPSHOT" + +export POLICY_PAP_VERSION="3.0.1-SNAPSHOT" + +export POLICY_APEX_PDP_VERSION="3.0.1-SNAPSHOT" + +export POLICY_DROOLS_PDP_VERSION="2.0.0-SNAPSHOT" + +export POLICY_XACML_PDP_VERSION="3.0.0-SNAPSHOT" + +export POLICY_DISTRIBUTION_VERSION="3.0.1-SNAPSHOT" + +export POLICY_CLAMP_VERSION="7.0.1-SNAPSHOT" + +export POLICY_GUI_VERSION="3.0.0-SNAPSHOT" + +export POLICY_DROOLS_APPS_VERSION="2.0.0-SNAPSHOT" diff --git a/compose/start-compose.sh b/compose/start-compose.sh index 49006f11..f4ded5c8 100755 --- a/compose/start-compose.sh +++ b/compose/start-compose.sh @@ -61,7 +61,7 @@ cd ${COMPOSE_FOLDER} echo "Configuring docker compose..." source export-ports.sh > /dev/null 2>&1 -source get-versions.sh > /dev/null 2>&1 +source fixed-versions.sh > /dev/null 2>&1 # in case of csit running for PAP (groups should be for pap) but starts apex-pdp for dependencies. if [ -z "$PROJECT" ]; then diff --git a/csit/resources/tests/api-test.robot b/csit/resources/tests/api-test.robot index 74ea7c4a..9bb2254e 100644 --- a/csit/resources/tests/api-test.robot +++ b/csit/resources/tests/api-test.robot @@ -108,16 +108,16 @@ Metrics [Documentation] Verify policy-api is exporting prometheus metrics ${auth}= PolicyAdminAuth ${resp}= GetMetrics ${POLICY_API_IP} ${auth} /policy/api/v1/ - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="POST",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="POST",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}",} 3.0 - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}",} 3.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_sum Should Contain ${resp.text} http_server_requests_seconds_max Should Contain ${resp.text} spring_data_repository_invocations_seconds_count diff --git a/csit/resources/tests/pap-test.robot b/csit/resources/tests/pap-test.robot index 09c26401..82328437 100644 --- a/csit/resources/tests/pap-test.robot +++ b/csit/resources/tests/pap-test.robot @@ -54,8 +54,8 @@ Metrics [Documentation] Verify policy pap is exporting prometheus metrics ${auth}= PolicyAdminAuth ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/ - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} - Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS",} 1.0 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS",} 1.0 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",} -- cgit 1.2.3-korg