Use healthchecks in docker-compose 51/143151/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Mon, 19 Jan 2026 17:03:28 +0000 (17:03 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Tue, 10 Feb 2026 14:02:55 +0000 (14:02 +0000)
- Ensure all containers have healthchecks in docker-compose
- Use docker-compose --wait instead of wait-for-ports.sh
- Remove hardcoded sleep timers in start-compose.sh

Issue-ID: POLICY-5534
Change-Id: I51a37c719f6c483edaa8249caf441f7c7ba6c8f0
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
12 files changed:
compose/compose.common.yml
compose/compose.postgres.yml
compose/compose.yaml
compose/config/db-migrator/init_pg.sh
compose/config/opa-pdp/policy-opa-pdp.sh [deleted file]
compose/export-ports.sh
compose/start-compose.sh
compose/wait_for_port.sh [deleted file]
csit/resources/scripts/wait_for_rest.sh [deleted file]
csit/run-acm-regression.sh
csit/run-project-csit.sh
policy-db-migrator/smoke-test/postgres-tests.sh

index 9082a00..62bd1ed 100644 (file)
@@ -40,6 +40,11 @@ services:
       - 6680
     ports:
       - ${SIMULATOR_PORT}:6666
+    healthcheck:
+      test: "nc -z localhost 6666 || exit 1"
+      interval: 5s
+      timeout: 5s
+      retries: 6
 
   x-policy-clamp-ac-sim-ppnt-template: &policy-clamp-ac-sim-ppnt-template
     image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_PPNT_VERSION}
@@ -56,6 +61,12 @@ services:
       OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
       SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default}
       OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true
+    healthcheck:
+      test: "curl --fail --silent --user 'participantUser:zb!XztG34' http://localhost:6969/onap/policy/simparticipant/health/readiness | grep -q UP || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-clamp-ac-sim-ppnt-1:
     <<: *policy-clamp-ac-sim-ppnt-template
@@ -108,6 +119,11 @@ services:
       - ${PROMETHEUS_PORT}:9090
     volumes:
       - ./metrics/prometheus.yml:/etc/prometheus/prometheus.yml
+    healthcheck:
+      test: "wget -q -O - http://localhost:9090/-/healthy || exit 1"
+      interval: 5s
+      timeout: 5s
+      retries: 6
 
   grafana:
     image: nexus3.onap.org:10001/grafana/grafana:latest
@@ -121,6 +137,11 @@ services:
       - ./metrics/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
       - ./metrics/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
       - ./metrics/dashboards:/var/lib/grafana/dashboards
+    healthcheck:
+      test: "wget -q -O - http://localhost:3000/api/health || exit 1"
+      interval: 5s
+      timeout: 5s
+      retries: 6
 
 # messaging services:
   zookeeper:
@@ -128,9 +149,14 @@ services:
     container_name: zookeeper
     hostname: zookeeper
     ports:
-      - "2181:2181"
+      - 2181:2181
     environment:
       ZOOKEEPER_CLIENT_PORT: 2181
+    healthcheck:
+      test: "nc -z localhost 2181 || exit 1"
+      interval: 5s
+      timeout: 5s
+      retries: 6
 
   kafka:
     image: nexus3.onap.org:10001/confluentinc/cp-kafka:7.4.9
@@ -139,8 +165,8 @@ services:
     depends_on:
       - zookeeper
     ports:
-      - "9092:9092"
-      - "29092:29092"
+      - 9092:9092
+      - 29092:29092
     environment:
       KAFKA_BROKER_ID: 1
       KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
@@ -149,18 +175,29 @@ services:
       KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
       KAFKA_ADVERTISED_HOST_NAME: kafka
+    healthcheck:
+      test: "kafka-topics --bootstrap-server kafka:29092 --list || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 10
+      start_period: 30s
 
   jaeger:
     image: nexus3.onap.org:10001/jaegertracing/all-in-one:1.58
     container_name: jaeger
     hostname: jaeger
     ports:
-      - "4318:4318"
-      - "4317:4317"
-      - "14250:14250"
-      - "16686:16686"
+      - 4318:4318
+      - 4317:4317
+      - 14250:14250
+      - 16686:16686
     environment:
       - COLLECTOR_OTLP_ENABLED=true
+    healthcheck:
+      test: "wget -q -O - http://localhost:14269/ || exit 1"
+      interval: 5s
+      timeout: 5s
+      retries: 6
 
 # integration tests:
   csit-tests:
index 9f311ab..cd198da 100644 (file)
@@ -1,6 +1,6 @@
 #
 # ===========LICENSE_START====================================================
-#  Copyright (C) 2024 Nordix Foundation.
+#  Copyright (C) 2024-2026 OpenInfra Foundation Europe. All rights reserved.
 # ============================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -23,23 +23,27 @@ services:
     image: nexus3.onap.org:10001/library/postgres:${POLICY_POSTGRES_VER}
     container_name: postgres
     hostname: postgres
-    command: [ '--idle_in_transaction_session_timeout=28800' ]
     env_file: config/db-pg/db-pg.conf
     volumes:
       - ./config/db-pg:/docker-entrypoint-initdb.d:ro
     expose:
       - 5432
     ports:
-      - "5432:5432"
+      - 5432:5432
+    healthcheck:
+      test: pg_isready -U policy_user -d policyadmin || exit 1
+      interval: 5s
+      timeout: 5s
+      retries: 10
+      start_period: 10s
 
   policy-db-migrator:
     image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION}
     container_name: policy-db-migrator
     hostname: policy-db-migrator
     depends_on:
-      - postgres
-    expose:
-      - 6824
+      postgres:
+        condition: service_healthy
     env_file: config/db-pg/db-pg.conf
     environment:
       POSTGRES_PASSWORD: policy_user
@@ -47,10 +51,4 @@ services:
       SQL_HOST: postgres
     volumes:
       - ./config/db-migrator/init_pg.sh:/opt/app/policy/bin/db_migrator_policy_init_pg.sh:ro
-      - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
-    entrypoint: /opt/app/policy/bin/wait_for_port.sh
-    command: [
-      '-c',
-      '/opt/app/policy/bin/db_migrator_policy_init_pg.sh',
-      'postgres', '5432'
-    ]
+    entrypoint: /opt/app/policy/bin/db_migrator_policy_init_pg.sh
index 751fc58..7e7cd64 100644 (file)
@@ -31,7 +31,8 @@ services:
     container_name: policy-api
     hostname: policy-api
     depends_on:
-      - policy-db-migrator
+      policy-db-migrator:
+        condition: service_completed_successfully
     ports:
       - ${API_PORT}:6969
     environment:
@@ -42,12 +43,12 @@ services:
     volumes:
       - ./config/api/apiParameters.yaml:/opt/app/policy/api/etc/apiParameters.yaml:ro
       - ./config/api/logback.xml:/opt/app/policy/api/etc/logback.xml:ro
-      - ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro
-    entrypoint: ./wait_for_port.sh
-    command: [
-      '-c', 'java -jar /app/api.jar',
-      'policy-db-migrator', '6824'
-    ]
+    healthcheck:
+      test: "curl --fail --silent --user 'policyadmin:zb!XztG34' http://localhost:6969/policy/api/v1/health | grep -q UP || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-pap:
     image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION}
@@ -67,13 +68,12 @@ services:
       - ./config/pap/papParameters.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro
       - ./config/${PROJECT:-api}/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro
       - ./config/pap/logback.xml:/opt/app/policy/pap/etc/logback.xml:ro
-      - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro
-    entrypoint: ./wait_for_port.sh
-    command: [
-      '-c', 'java -jar /app/pap.jar --group-config-file=/opt/app/policy/pap/etc/mounted/groups.json',
-      'policy-api', '6969',
-      'kafka', '9092'
-    ]
+    healthcheck:
+      test: "curl --fail --silent --user 'policyadmin:zb!XztG34' http://localhost:6969/policy/pap/v1/health | grep -q UP || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-apex-pdp:
     image: ${CONTAINER_LOCATION}onap/policy-apex-pdp:${POLICY_APEX_PDP_VERSION}
@@ -81,7 +81,6 @@ services:
     hostname: policy-apex-pdp
     depends_on:
       - policy-models-simulator
-      - kafka
       - policy-pap
     ports:
       - ${APEX_PORT}:6969
@@ -89,13 +88,13 @@ services:
     volumes:
       - ./config/apex-pdp/OnapPfConfig.json:/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json:ro
       - ./config/apex-pdp/logback.xml:/opt/app/policy/apex-pdp/etc/logback.xml:ro
-      - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
-    entrypoint: /opt/app/policy/bin/wait_for_port.sh
-    command: [
-      '-c', '/opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json',
-      'kafka', '9092',
-      'policy-pap', '6969'
-    ]
+    entrypoint: /opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json
+    healthcheck:
+      test: "curl --fail --silent --user 'policyadmin:zb!XztG34' http://localhost:6969/policy/apex-pdp/v1/healthcheck | grep -q '\"healthy\":true' || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-distribution:
     image: ${CONTAINER_LOCATION}onap/policy-distribution:${POLICY_DISTRIBUTION_VERSION}
@@ -109,12 +108,12 @@ services:
       - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json:ro
       - /tmp/distribution/:/opt/app/policy/distribution/etc/temp/:ro
       - ./config/distribution/logback.xml:/opt/app/policy/distribution/etc/logback.xml:ro
-      - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
-    entrypoint: /opt/app/policy/bin/wait_for_port.sh
-    command: [
-      '-c', './policy-dist.sh',
-      'policy-apex-pdp', '6969'
-    ]
+    healthcheck:
+      test: "curl --fail --silent --user 'policyadmin:zb!XztG34' http://localhost:6969/healthcheck | grep -q '\"healthy\":true' || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-xacml-pdp:
     image: ${CONTAINER_LOCATION}onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION}
@@ -122,43 +121,40 @@ services:
     hostname: policy-xacml-pdp
     depends_on:
       - policy-pap
-      - kafka
     ports:
       - ${XACML_PORT}:6969
       - 30999:3904
     volumes:
       - ./config/xacml-pdp/defaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro
       - ./config/xacml-pdp/logback.xml:/opt/app/policy/pdpx/etc/logback.xml:ro
-      - ./config/xacml-pdp/xacml-postgres.properties:/opt/app/policy/pdpx/apps/guard/xacml.properties:ro
-      - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro
-    entrypoint: ./wait_for_port.sh
-    command: [
-      '-c', './policy-pdpx.sh',
-      'policy-pap', '6969',
-      'kafka', '9092'
-    ]
+      - ./config/xacml-pdp/xacml-${database:-postgres}.properties:/opt/app/policy/pdpx/apps/guard/xacml.properties:ro
+    healthcheck:
+      test: "curl --fail --silent --user 'policyadmin:zb!XztG34' http://localhost:6969/policy/pdpx/v1/healthcheck | grep -q '\"healthy\":true' || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-opa-pdp:
     image: ${CONTAINER_LOCATION}onap/policy-opa-pdp:${POLICY_OPA_PDP_VERSION}
     container_name: policy-opa-pdp
     hostname: policy-opa-pdp
     depends_on:
-      - kafka
       - policy-pap
     ports:
       - ${OPA_PDP_PORT}:8282
     volumes:
       - ./config/opa-pdp/config.json:/app/config/config.json:ro
       - ./config/opa-pdp/policy-opa-pdp.sh:/app/policy-opa-pdp.sh:ro
-      - ./wait_for_port.sh:/app/wait_for_port.sh:ro
     env_file:
       - ./config/opa-pdp/opa-pdp.env
-    entrypoint: ./wait_for_port.sh
-    command: [
-      '-c', './policy-opa-pdp.sh',
-      'kafka', '9092',
-      'policy-pap', '6969'
-    ]
+    entrypoint: /app/opa-pdp
+    healthcheck:
+      test: "curl --fail --silent --user 'policyadmin:zb!XztG34' http://localhost:8282/policy/pdpo/v1/healthcheck | grep -q '\"healthy\":true' || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-drools-pdp:
     image: ${CONTAINER_LOCATION}onap/policy-drools:${POLICY_DROOLS_PDP_VERSION}
@@ -166,21 +162,20 @@ services:
     hostname: policy-drools-pdp
     depends_on:
       - policy-pap
-      - kafka
     ports:
       - ${DROOLS_PORT}:6969
       - ${DROOLS_TELEMETRY_PORT}:9696
     volumes:
       - ./config/drools-pdp/custom:/tmp/policy-install/config:ro
-      - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
     env_file:
-      - config/drools-pdp/env/base-postgres.conf
-    entrypoint: /opt/app/policy/bin/wait_for_port.sh
-    command: [
-      '-c', '/opt/app/policy/bin/pdpd-entrypoint.sh boot',
-      'policy-pap', '6969',
-      'kafka', '9092'
-    ]
+      - config/drools-pdp/env/base-${database:-postgres}.conf
+    # Note drools-pdp does not expose 6969, so instead nc to telemetry port
+    healthcheck:
+      test: nc -z localhost 9696 || exit 1
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-drools-apps:
     image: ${CONTAINER_LOCATION}onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION}
@@ -190,32 +185,27 @@ services:
       - policy-pap
       - policy-xacml-pdp
       - policy-models-simulator
-      - kafka
     ports:
       - ${DROOLS_APPS_PORT}:6969
       - ${DROOLS_APPS_TELEMETRY_PORT}:9696
     volumes:
       - ./config/drools-applications/custom:/tmp/policy-install/config:ro
-      - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
     env_file:
       - config/drools-applications/env/base-postgres.conf
       - config/drools-applications/env/feature-healthcheck.conf
       - config/drools-applications/env/feature-pooling-messages.conf
-    entrypoint: /opt/app/policy/bin/wait_for_port.sh
-    command: [
-      '-c', '/opt/app/policy/bin/pdpd-cl-entrypoint.sh boot',
-      'policy-pap', '6969',
-      'kafka', '9092',
-      'aai-sim', '6666',
-      'sdnc-sim', '6668',
-      'so-sim', '6669'
-    ]
+    healthcheck:
+      test: "curl --fail --silent --user 'demo@people.osaaf.org:demo123456!' http://localhost:6969/healthcheck | grep -q '\"healthy\":true' || exit 1"
+      interval: 10s
+      timeout: 10s
+      retries: 12
+      start_period: 30s
 
   policy-clamp-runtime-acm:
     image: ${CONTAINER_LOCATION}onap/policy-clamp-runtime-acm:${POLICY_CLAMP_VERSION}
     hostname: policy-clamp-runtime-acm
     depends_on:
-      - policy-apex-pdp
+      - postgres
       - kafka
       - jaeger
       - policy-clamp-ac-pf-ppnt
@@ -252,11 +242,11 @@ services:
         -Dotel.java.global-autoconfigure.enabled=true
       SPRING_PROFILES_ACTIVE: ${CLAMP_PROFILE:-default}
     healthcheck:
-      test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/actuator/health/readiness | grep UP || exit 1"
-      interval: 30s
+      test: "curl --fail --silent --user 'runtimeUser:zb!XztG34' http://localhost:6969/onap/policy/clamp/acm/actuator/health/readiness | grep -q UP || exit 1"
+      interval: 10s
       timeout: 10s
-      retries: 5
-      start_period: 60s
+      retries: 12
+      start_period: 30s
 
   policy-clamp-ac-http-ppnt:
     image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-http-ppnt:${POLICY_CLAMP_PPNT_VERSION}
@@ -264,8 +254,6 @@ services:
     depends_on:
       - kafka
       - jaeger
-    expose:
-      - 6969
     deploy:
       replicas: ${ACM_REPLICAS:-1}
     environment:
@@ -280,11 +268,11 @@ services:
       OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true
       SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default}
     healthcheck:
-      test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/httpparticipant/health/readiness | grep UP || exit 1"
-      interval: 30s
+      test: "curl --fail --silent --user 'participantUser:zb!XztG34' http://localhost:6969/onap/policy/clamp/acm/httpparticipant/health/readiness | grep -q UP || exit 1"
+      interval: 10s
       timeout: 10s
-      retries: 5
-      start_period: 60s
+      retries: 12
+      start_period: 30s
 
   policy-clamp-ac-k8s-ppnt:
     image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-k8s-ppnt:${POLICY_CLAMP_PPNT_VERSION}
@@ -292,8 +280,6 @@ services:
     depends_on:
       - kafka
       - jaeger
-    expose:
-      - 6969
     deploy:
       replicas: ${ACM_REPLICAS:-1}
     environment:
@@ -308,11 +294,11 @@ services:
       OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true
       SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default}
     healthcheck:
-      test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/k8sparticipant/health/readiness | grep UP || exit 1"
-      interval: 30s
+      test: "curl --fail --silent --user 'participantUser:zb!XztG34' http://localhost:6969/onap/policy/clamp/acm/k8sparticipant/health/readiness | grep -q UP || exit 1"
+      interval: 10s
       timeout: 10s
-      retries: 5
-      start_period: 20s
+      retries: 12
+      start_period: 30s
 
   policy-clamp-ac-pf-ppnt:
     image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-pf-ppnt:${POLICY_CLAMP_PPNT_VERSION}
@@ -320,9 +306,8 @@ services:
     depends_on:
       - kafka
       - policy-api
+      - policy-apex-pdp
       - jaeger
-    expose:
-      - 6969
     deploy:
       replicas: ${ACM_REPLICAS:-1}
     environment:
@@ -341,10 +326,10 @@ services:
       OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true
       SPRING_PROFILES_ACTIVE: ${PPNT_PROFILE:-default}
     healthcheck:
-      test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/policyparticipant/health/readiness | grep UP || exit 1"
-      interval: 30s
+      test: "curl --fail --silent --user 'participantUser:zb!XztG34' http://localhost:6969/onap/policy/clamp/acm/policyparticipant/health/readiness | grep -q UP || exit 1"
+      interval: 10s
       timeout: 10s
-      retries: 5
+      retries: 12
       start_period: 30s
 
   policy-clamp-ac-a1pms-ppnt:
@@ -353,8 +338,6 @@ services:
     depends_on:
       - kafka
       - jaeger
-    expose:
-      - 6969
     deploy:
       replicas: ${ACM_REPLICAS:-1}
     environment:
@@ -368,11 +351,11 @@ services:
       OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
       OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true
     healthcheck:
-      test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/a1pmsparticipant/health/readiness | grep UP || exit 1"
-      interval: 30s
+      test: "curl --fail --silent --user 'participantUser:zb!XztG34' http://localhost:6969/onap/policy/clamp/acm/a1pmsparticipant/health/readiness | grep -q UP || exit 1"
+      interval: 10s
       timeout: 10s
-      retries: 5
-      start_period: 20s
+      retries: 12
+      start_period: 30s
 
   policy-clamp-ac-kserve-ppnt:
     image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-kserve-ppnt:${POLICY_CLAMP_PPNT_VERSION}
@@ -380,8 +363,6 @@ services:
     depends_on:
       - kafka
       - jaeger
-    expose:
-      - 6969
     deploy:
       replicas: ${ACM_REPLICAS:-1}
     environment:
@@ -395,8 +376,8 @@ services:
       OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
       OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED: true
     healthcheck:
-      test: "curl --fail --silent http://localhost:6969/onap/policy/clamp/acm/kserveparticipant/health/readiness | grep UP || exit 1"
-      interval: 30s
+      test: "curl --fail --silent --user 'participantUser:zb!XztG34' http://localhost:6969/onap/policy/clamp/acm/kserveparticipant/health/readiness | grep -q UP || exit 1"
+      interval: 10s
       timeout: 10s
-      retries: 5
-      start_period: 20s
+      retries: 12
+      start_period: 30s
index 712d0d2..057fef5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # ============LICENSE_START====================================================
-#  Copyright (C) 2022, 2024 Nordix Foundation.
+#  Copyright (C) 2022-2026 OpenInfra Foundation Europe. All rights reserved.
 # =============================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -38,6 +38,4 @@ for schema in ${SQL_DB}; do
     fi
 done
 
-nc -l -p 6824
-
 exit $rc
diff --git a/compose/config/opa-pdp/policy-opa-pdp.sh b/compose/config/opa-pdp/policy-opa-pdp.sh
deleted file mode 100755 (executable)
index 5ce72c3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-## -
-##   ========================LICENSE_START=================================
-##   Copyright (C) 2024: Deutsche Telekom
-##
-##   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===================================
-##
-
-
-#Execution of OPA-PDP bin
-sleep 40
-/app/opa-pdp
index 830dc0b..7710374 100755 (executable)
@@ -24,17 +24,17 @@ export APEX_EVENTS_PORT=23324
 export API_PORT=30002
 export PAP_PORT=30003
 export XACML_PORT=30004
-export OPA_PDP_PORT=30012
 export DROOLS_PORT=30005
 export DROOLS_TELEMETRY_PORT=30216
 export DIST_PORT=30006
 export ACM_PORT=30007
 export ACM_PORT_END=30008
+export DROOLS_APPS_PORT=30009
+export DROOLS_APPS_TELEMETRY_PORT=30219
+export OPA_PDP_PORT=30012
 export SIM_PARTICIPANT1_PORT=30011
 export SIM_PARTICIPANT2_PORT=30013
 export SIM_PARTICIPANT3_PORT=30014
-export DROOLS_APPS_PORT=30009
-export DROOLS_APPS_TELEMETRY_PORT=30219
 export SIMULATOR_PORT=30904
 export KAFKA_PORT=29092
 export PROMETHEUS_PORT=30259
index fb65ab7..2815f2a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # ============LICENSE_START====================================================
-#  Copyright (C) 2022-2025 Nordix Foundation.
+#  Copyright (C) 2022-2026 OpenInfra Foundation Europe. All rights reserved.
 # =============================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -74,15 +74,15 @@ fi
 
 if [ -n "$component" ]; then
   if [ "$grafana" = true ]; then
-    docker compose up -d "${component}" postgres grafana
+    docker compose up -d "${component}" postgres grafana --wait
     echo "Prometheus server: http://localhost:${PROMETHEUS_PORT}"
     echo "Grafana server: http://localhost:${GRAFANA_PORT}"
   else
-    docker compose up -d "${component}" postgres
+    docker compose up -d "${component}" postgres --wait
   fi
 else
   export PROJECT=policy-api # policy-api has groups.json complete with all 3 pdps
-  docker compose up -d
+  docker compose up -d --wait
 fi
 
 cd "${WORKSPACE}"
diff --git a/compose/wait_for_port.sh b/compose/wait_for_port.sh
deleted file mode 100755 (executable)
index 6dcb3ca..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-# ============LICENSE_START====================================================
-#  Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
-#  Modifications Copyright (C) 2022-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======================================================
-
-usage() {
-    echo args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ... >&2
-    exit 1
-}
-
-tmout=300
-cmd=
-while getopts c:t: opt
-do
-    case "$opt" in
-        c)
-            cmd="$OPTARG"
-            ;;
-
-        t)
-            tmout="$OPTARG"
-            ;;
-
-        *)
-            usage
-            ;;
-    esac
-done
-
-nargs=$((OPTIND-1))
-shift "$nargs"
-
-even_args=$(($#%2))
-if [ $# -lt 2 ] || [ "$even_args" -ne 0 ]
-then
-    usage
-fi
-
-while [ $# -ge 2 ]
-do
-    export host="$1"
-    export port="$2"
-    shift
-    shift
-
-    echo "Waiting for $host port $port..."
-
-    while [ "$tmout" -gt 0 ]
-    do
-        if command -v docker > /dev/null 2>&1
-        then
-            docker ps --format "table {{ .Names }}\t{{ .Status }}"
-        fi
-
-        nc -vz "$host" "$port"
-        rc=$?
-
-        if [ $rc -eq 0 ]
-        then
-            break
-        else
-            tmout=$((tmout-1))
-            sleep 1
-        fi
-    done
-
-    if [ $rc -ne 0 ]
-    then
-        echo "$host port $port cannot be reached"
-        exit $rc
-    fi
-done
-
-$cmd
-
-exit 0
diff --git a/csit/resources/scripts/wait_for_rest.sh b/csit/resources/scripts/wait_for_rest.sh
deleted file mode 100755 (executable)
index b51a7fe..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-# ============LICENSE_START====================================================
-# 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.
-# 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======================================================
-usage() {
-    echo args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ... >&2
-    exit 1
-}
-tmout=300
-cmd=
-while getopts c:t: opt
-do
-    case "$opt" in
-        c)
-            cmd="$OPTARG"
-            ;;
-        t)
-            tmout="$OPTARG"
-            ;;
-        *)
-            usage
-            ;;
-    esac
-done
-nargs=$((OPTIND-1))
-shift "$nargs"
-even_args=$(($#%2))
-if [ $# -lt 2 ] || [ "$even_args" -ne 0 ]
-then
-    usage
-fi
-while [ $# -ge 2 ]
-do
-    export host="$1"
-    export port="$2"
-    shift
-    shift
-    echo "Checking if REST port $port is open on $host ..."
-    while [ "$tmout" -gt 0 ]
-    do
-        if command -v docker > /dev/null 2>&1
-        then
-            docker ps --format "table {{ .Image }}\t{{ .Names }}\t{{ .Status }}"
-        fi
-        curl "http://$host:$port" > /dev/null 2>&1
-        rc=$?
-        if [ $rc -eq 0 ]
-        then
-            break
-        else
-            tmout=$((tmout-5))
-            sleep 5
-        fi
-    done
-    if [ $rc -ne 0 ]; then
-        echo "REST port $port cannot be detected on host $host"
-        exit $rc
-    fi
-done
-$cmd
-exit 0
-
index 1916002..15c929f 100755 (executable)
@@ -126,10 +126,7 @@ source export-ports.sh > /dev/null 2>&1
 
 export CONTAINER_LOCATION="nexus3.onap.org:10001/"
 
-docker compose up -d "policy-clamp-runtime-acm"
-
-# wait for the app to start up
-"${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}"
+docker compose up policy-clamp-runtime-acm -d --wait
 
 cd ${REGRESSION_FOLDER}
 
index 64f91ee..9b39b14 100755 (executable)
@@ -3,7 +3,7 @@
 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
 # Modification Copyright 2019 © Samsung Electronics Co., Ltd.
 # Modification Copyright 2021 © AT&T Intellectual Property.
-# Modification Copyright 2021-2025 OpenInfra Foundation Europe.
+# Modification Copyright 2021-2026 OpenInfra Foundation Europe.
 # Modifications Copyright 2024-2025 Deutsche Telekom
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -57,115 +57,54 @@ function docker_stats(){
     echo
 }
 
-function apex_healthcheck() {
-    sleep 20
-
-    healthy=false
-
-    while [ $healthy = false ]
-    do
-        msg=$(curl -s -k --user 'policyadmin:zb!XztG34' http://localhost:"${APEX_PORT}"/policy/apex-pdp/v1/healthcheck)
-        echo "${msg}" | grep -q true
-        if [ "${?}" -eq 0 ]
-        then
-            healthy=true
-            break
-        fi
-        sleep 10s
-    done
-
-    if  [ $healthy = false ]; then
-        exit 2
-    fi
-}
-
-function check_rest_endpoint() {
-    bash "${SCRIPTS}"/wait_for_rest.sh localhost "${1}"
-    rc=$?
-    if [ $rc -ne 0 ]; then
-        on_exit
-    fi
-}
-
 function setup_clamp() {
     export ROBOT_FILES="clamp-health-check.robot clamp-db-restore.robot clamp-single-element-test.robot clamp-timeout-test.robot
     clamp-migrate-rollback.robot clamp-trace-test.robot clamp-slas.robot"
     export TEST_ENV="docker"
     export PROJECT="clamp"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-clamp-runtime-acm --grafana
-    echo "Waiting 2 minutes for the replicas to be started..."
-    sleep 120
-    check_rest_endpoint "${ACM_PORT}"
 }
 
 function setup_api() {
     export ROBOT_FILES="api-test.robot api-slas.robot"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-api --grafana
-    echo "Waiting 1 minute for policy-api to start..."
-    sleep 60
-    check_rest_endpoint "${API_PORT}"
 }
 
 function setup_pap() {
     export ROBOT_FILES="pap-test.robot pap-slas.robot"
     export PROJECT="pap"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-apex-pdp --grafana
-    echo "Waiting 1 minute for policy-pap to start..."
-    sleep 60
-    check_rest_endpoint "${PAP_PORT}"
-    check_rest_endpoint "${APEX_PORT}"
-    apex_healthcheck
 }
 
 function setup_apex() {
     export ROBOT_FILES="apex-pdp-test.robot apex-slas.robot"
     export PROJECT="apex-pdp"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-apex-pdp --grafana
-    echo "Waiting 1 minute for apex-pdp to start..."
-    sleep 60
-    check_rest_endpoint "${PAP_PORT}"
-    check_rest_endpoint "${APEX_PORT}"
-    apex_healthcheck
 }
 
-
-
 function setup_drools_apps() {
     export ROBOT_FILES="drools-applications-test.robot drools-applications-slas.robot"
     export PROJECT="drools-applications"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-drools-apps --grafana
-    echo "Waiting 1 minute for drools-pdp and drools-applications to start..."
-    sleep 80
-    check_rest_endpoint "${PAP_PORT}"
-    check_rest_endpoint "${XACML_PORT}"
-    check_rest_endpoint "${DROOLS_APPS_PORT}"
-    check_rest_endpoint "${DROOLS_APPS_TELEMETRY_PORT}"
 }
 
 function setup_xacml_pdp() {
     export ROBOT_FILES="xacml-pdp-test.robot xacml-pdp-slas.robot"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-xacml-pdp --grafana
-    echo "Waiting 1 minute for xacml-pdp to start..."
-    sleep 60
-    check_rest_endpoint "${XACML_PORT}"
 }
 
 function setup_opa_pdp() {
     export ROBOT_FILES="opa-pdp-test.robot opa-pdp-slas.robot"
     export PROJECT="opa-pdp"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-opa-pdp --grafana
-    echo "Waiting 3 minutes for OPA-PDP to start..."
-    sleep 180
-    check_rest_endpoint "${PAP_PORT}"
-    check_rest_endpoint "${OPA_PDP_PORT}"
+    # Note opa-pdp healthcheck passes but the tests fail without sleeping
+    echo "Waiting 2 minutes for OPA-PDP to start..."
+    sleep 120
 }
 
 function setup_drools_pdp() {
     export ROBOT_FILES="drools-pdp-test.robot"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-drools-pdp --grafana
-    echo "Waiting 1 minute for drools-pdp to start..."
-    sleep 60
-    check_rest_endpoint "${DROOLS_TELEMETRY_PORT}"
 }
 
 function setup_distribution() {
@@ -178,11 +117,6 @@ function setup_distribution() {
 
     export ROBOT_FILES="distribution-test.robot"
     source "${DOCKER_COMPOSE_DIR}"/start-compose.sh policy-distribution --grafana
-    echo "Waiting 1 minute for distribution to start..."
-    sleep 60
-    check_rest_endpoint "${DIST_PORT}"
-    check_rest_endpoint "${APEX_PORT}"
-    apex_healthcheck
 }
 
 function build_robot_image() {
index be38a5d..1f65323 100755 (executable)
@@ -190,6 +190,4 @@ echo "-----------------------------------------------------------------------"
 
 echo "End of test $(date +%F-%T)"
 
-nc -lk -p 6824
-
 exit 0