From 46b097a41ae6f8e112863eb5c4ba309642dee796 Mon Sep 17 00:00:00 2001 From: Pedro Pereira Date: Sat, 22 Jun 2024 12:23:51 +0100 Subject: [PATCH] Feature 10991: k8s_04 test now checks labels injected into Kubernetes objects before executing the upgrade operation Change-Id: I89c9e281e2b851135545d4f72f21ed8820db5275 Signed-off-by: Pedro Pereira --- robot-systest/lib/ns_lib.resource | 16 ++++++++++++++++ .../testsuite/k8s_04-openldap_helm.robot | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/robot-systest/lib/ns_lib.resource b/robot-systest/lib/ns_lib.resource index 9b2cc6f..9c996c0 100644 --- a/robot-systest/lib/ns_lib.resource +++ b/robot-systest/lib/ns_lib.resource @@ -182,6 +182,22 @@ Get Vnf Vdur Names @{vdur}= Split String ${stdout} RETURN @{vdur} +Check Kdu Labels + [Documentation] Return the labels of the deployed Kubernetes objects associated with a NS instance. + [Arguments] ${ns_id} ${vnf_id} ${kdu_name} + Should Not Be Empty ${ns_id} + Should Not Be Empty ${vnf_id} + Should Not Be Empty ${kdu_name} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-show ${ns_id} --literal | yq -r '._admin.deployed.K8s[0]."detailed-status"' | yq -r '.manifest[0].metadata.labels' + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + ${labels}= Evaluate json.loads('''${stdout}''') json + Should Be Equal As Strings ${labels["managed-by"]} osm.etsi.org msg=${labels} + Should Be Equal As Strings ${labels["osm.etsi.org/ns-id"]} ${ns_id} msg=${labels} + Should Be Equal As Strings ${labels["osm.etsi.org/vnf-id"]} ${vnf_id} msg=${labels} + Should Be Equal As Strings ${labels["osm.etsi.org/kdu-name"]} ${kdu_name} msg=${labels} + RETURN ${labels} + Get Vnf Kdu Replica Count [Documentation] Return the number of KDU replicas (empty if none) of a VNF instance. [Arguments] ${vnf_id} ${kdu_name} diff --git a/robot-systest/testsuite/k8s_04-openldap_helm.robot b/robot-systest/testsuite/k8s_04-openldap_helm.robot index 74cd4d5..a37d653 100644 --- a/robot-systest/testsuite/k8s_04-openldap_helm.robot +++ b/robot-systest/testsuite/k8s_04-openldap_helm.robot @@ -84,6 +84,13 @@ Get Vnf Id Log List ${vnfr_list} Set Suite Variable ${VNF_ID} ${vnfr_list}[0] +Check Labels Injected Into Kubernetes Objects + [Documentation] Check that labels were correctly injected into the deployed Kubernetes objects. + [Tags] verify + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${stdout}= Check Kdu Labels ${NS_ID} ${VNF_ID} ${KDU_NAME} + Log ${stdout} + Execute Upgrade Operation [Documentation] Perform OSM action to upgrade the number of replicas of a deployment in the CNF. [Tags] verify -- 2.25.1