From: halil.cakal Date: Mon, 7 Jul 2025 11:03:06 +0000 (+0100) Subject: Fix endurance failures X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=50d59b8d661be181e4bb0a7f329cfb435f94b809;p=cps.git Fix endurance failures - endurance test failed since it exited with 'Unsucessful' termination because teardown.sh was not able to remove CPS images (cps-and-nmcp, policy-executor-stub). The tag 'latest' was used for both pipelines at the same time: Regular KPI and Endurance - teardown algorithm changed: it only remove cps images having 'Snapshot' tag. - dmi-stub removed from the image list since it should always use the Snapshot version in the deployment! Issue-ID: CPS-2870 Change-Id: I1a7d6dbf717e2686c70d845e6f44c7efb1171dae Signed-off-by: halil.cakal --- diff --git a/k6-tests/teardown.sh b/k6-tests/teardown.sh index 0ee8af6b3e..a51ede2de0 100755 --- a/k6-tests/teardown.sh +++ b/k6-tests/teardown.sh @@ -30,14 +30,18 @@ docker_compose_shutdown_cmd="docker-compose -f ../docker-compose/docker-compose. # nexus3.onap.org:10003/onap/dmi-stub:1.8.0-SNAPSHOT # nexus3.onap.org:10003/onap/policy-executor-stub:latest remove_cps_images() { - local cps_image_names=(cps-and-ncmp dmi-stub policy-executor-stub) + local cps_image_names=(cps-and-ncmp policy-executor-stub) for cps_image_name in "${cps_image_names[@]}"; do local image_path="nexus3.onap.org:10003/onap/$cps_image_name" - # list all image IDs for this repository (all tags) - image_tags=$(docker images -q "$image_path") - if [ -n "$image_tags" ]; then - echo "Removing images for $image_path..." - docker rmi -f $image_tags + # list all images for all tags except 'latest' since it would be in use + # result will store in snapshot_tags[0], snapshot_tags[1] + local snapshot_tags=( $(docker images "$image_path" --format '{{.Tag}}' | grep -v '^latest$') ) + if [ ${#snapshot_tags[@]} -gt 0 ]; then + echo "Removing snapshot images for tags $image_path: ${snapshot_tags[*]}" + # remove each snapshot image explicitly + for tag in "${snapshot_tags[@]}"; do + docker rmi "$image_path:$tag" + done fi done }