Commit d6a50486 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

NBI component:

- Fixed loop in unitary tests and scripts that waits for NBI component workers to be started
parent b8ccc35c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -59,10 +59,12 @@ docker run --name nbi -d \
    --env "KFK_SERVER_ADDRESS=${KAFKA_IP}:9092" \
    nbi:latest

while ! docker logs nbi 2>&1 | grep -q 'Initialization completed'; do
    printf "."
    sleep 1;
done
# Wait until any worker logs "Initialization completed" (from the start of logs)
# -m1 makes grep exit as soon as the line appears.
# With set -o pipefail, docker logs will get SIGPIPE when grep exits;
#   `|| true` neutralizes that so the pipeline’s status reflects grep’s success.
(docker logs -f $IMAGE_NAME || true) 2>&1 | grep -m1 -Fi 'Initialization completed'

printf "\n"
sleep 5 # Give extra time to NBI to get ready

+1 −3
Original line number Diff line number Diff line
@@ -103,13 +103,11 @@ unit_test nbi:
      --env IETF_NETWORK_RENDERER=LIBYANG
      --env "KFK_SERVER_ADDRESS=${KAFKA_IP}:9092"
      $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
    # Old version that gets blocked:
    #- while ! docker logs $IMAGE_NAME 2>&1 | grep -q 'Initialization completed'; do sleep 5; done
    # Wait until any worker logs "Initialization completed" (from the start of logs)
    # -m1 makes grep exit as soon as the line appears.
    # With set -o pipefail, docker logs will get SIGPIPE when grep exits;
    #   `|| true` neutralizes that so the pipeline’s status reflects grep’s success.
    - (docker logs -f nbi || true) 2>&1 | grep -m1 -Fi 'Initialization completed'
    - (docker logs -f $IMAGE_NAME || true) 2>&1 | grep -m1 -Fi 'Initialization completed'
    - sleep 5 # Give extra time to NBI to get ready
    - docker ps -a
    - docker logs kafka