diff --git a/.github/workflows/validate_tutorials.yaml b/.github/workflows/validate_tutorials.yaml index afd19d9eb..0c932e9d7 100644 --- a/.github/workflows/validate_tutorials.yaml +++ b/.github/workflows/validate_tutorials.yaml @@ -185,64 +185,175 @@ jobs: # pushd tutorials/observability # make validate # popd - # Validation for workflows is intentionally commented out. - # Mechanical markdown is not able to invoke the workflow services. - # Once this feature has been added to Mechanical Markdown the - # workflow validations can be enabled. - #- name: Validate workflow/csharp/child-workflows - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/child-workflows - # make validate - # popd - #- name: Validate workflow/csharp/combined-patterns - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/combined-patterns - # make validate - # popd - #- name: Validate workflow/csharp/external-system-interaction - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/external-system-interaction - # make validate - # popd - #- name: Validate workflow/csharp/fan-out-fan-in - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/fan-out-fan-in - # make validate - # popd - #- name: Validate workflow/csharp/fundamentals - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/fundamentals - # make validate - # popd - #- name: Validate workflow/csharp/monitor-pattern - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/monitor-pattern - # make validate - # popd - #- name: Validate workflow/csharp/resiliency-and-compensation - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/resiliency-and-compensation - # make validate - # popd - #- name: Validate workflow/csharp/task-chaining - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/task-chaining - # make validate - # popd - #- name: Validate workflow/csharp/workflow-management - # if: matrix.os == 'ubuntu-latest' - # run: | - # pushd tutorials/workflow/csharp/workflow-management - # make validate - # popd #- name: Linkcheck README.md # run: | # make validate + + # Validation of the workflow tutorials. Mechanical Markdown cannot drive their long-running + # services, so tutorials/workflow/validate.sh starts each tutorial, sends the requests of its + # .http file and checks every workflow instance through the Dapr workflow API. + # The challenges-tips tutorials are excluded: they hold code snippets only and have nothing to run. + workflow-tutorials: + name: Workflow tutorial ${{ matrix.lang }}/${{ matrix.topic }} + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - { lang: python, topic: child-workflows } + - { lang: python, topic: external-system-interaction } + - { lang: python, topic: fan-out-fan-in } + - { lang: python, topic: fundamentals } + - { lang: python, topic: history-propagation } + - { lang: python, topic: monitor-pattern } + - { lang: python, topic: resiliency-and-compensation } + - { lang: python, topic: task-chaining } + - { lang: python, topic: versioning } + - { lang: python, topic: workflow-management } + - { lang: csharp, topic: child-workflows } + - { lang: csharp, topic: external-system-interaction } + - { lang: csharp, topic: fan-out-fan-in } + - { lang: csharp, topic: fundamentals } + - { lang: csharp, topic: history-propagation } + - { lang: csharp, topic: monitor-pattern } + - { lang: csharp, topic: resiliency-and-compensation } + - { lang: csharp, topic: task-chaining } + - { lang: csharp, topic: versioning } + - { lang: csharp, topic: workflow-management } + - { lang: go, topic: history-propagation } + - { lang: java, topic: child-workflows } + - { lang: java, topic: external-system-interactions } + - { lang: java, topic: fan-out-fan-in } + - { lang: java, topic: fundamentals } + - { lang: java, topic: history-propagation } + - { lang: java, topic: monitor-pattern } + - { lang: java, topic: resiliency-and-compensation } + - { lang: java, topic: task-chaining } + - { lang: java, topic: versioning } + - { lang: java, topic: workflow-management } + - { lang: java, topic: combined-patterns } + steps: + - name: Check out code + uses: actions/checkout@v7 + - name: Load environment variables + uses: artursouza/export-env-action@v2 + with: + envFile: './.github/env/global.env' + expand: 'true' + - name: Install uv + if: matrix.lang == 'python' + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + - name: Install .NET + if: matrix.lang == 'csharp' + uses: actions/setup-dotnet@v6 + with: + dotnet-version: 10.0.x + - name: Set up Go ${{ env.GOVER }} + if: matrix.lang == 'go' + uses: actions/setup-go@v7 + with: + go-version: ${{ env.GOVER }} + cache: false + - name: Set up OpenJDK 17 + if: matrix.lang == 'java' + uses: actions/setup-java@v6 + with: + distribution: 'temurin' + java-version: 17 + - name: Set up Dapr CLI + run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }} + - name: Install the Dapr binaries + # Java tutorials start Dapr with Testcontainers and need no local Dapr runtime. + if: matrix.lang != 'java' + run: | + export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + dapr init --slim --runtime-version=${{ env.DAPR_RUNTIME_VERSION }} + dapr --version + - name: Start the Scheduler and Placement services + # The commands of "Run the tutorials without Docker" in the language README. + if: matrix.lang != 'java' + run: | + mkdir -p "$RUNNER_TEMP/scheduler-data" + nohup "$HOME/.dapr/bin/scheduler" --etcd-data-dir "$RUNNER_TEMP/scheduler-data" > "$RUNNER_TEMP/scheduler.log" 2>&1 & + nohup "$HOME/.dapr/bin/placement" --healthz-port 8081 --metrics-port 9091 > "$RUNNER_TEMP/placement.log" 2>&1 & + for port in 8080 8081; do + curl --silent --fail --retry 30 --retry-connrefused --retry-delay 1 "http://localhost:$port/healthz" > /dev/null + done + - name: Validate workflow/${{ matrix.lang }}/${{ matrix.topic }} + run: bash tutorials/workflow/validate.sh ${{ matrix.lang }} ${{ matrix.topic }} + + # combined-patterns uses Redis for pub/sub, so these topics run with a Redis service container. + workflow-tutorials-redis: + name: Workflow tutorial ${{ matrix.lang }}/${{ matrix.topic }} (Redis) + runs-on: ubuntu-latest + timeout-minutes: 60 + services: + redis: + image: redis:7 + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s + --health-timeout 3s + --health-retries 10 + strategy: + fail-fast: false + matrix: + include: + - { lang: python, topic: combined-patterns } + - { lang: csharp, topic: combined-patterns } + steps: + - name: Check out code + uses: actions/checkout@v7 + - name: Load environment variables + uses: artursouza/export-env-action@v2 + with: + envFile: './.github/env/global.env' + expand: 'true' + - name: Install uv + if: matrix.lang == 'python' + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + - name: Install .NET + if: matrix.lang == 'csharp' + uses: actions/setup-dotnet@v6 + with: + dotnet-version: 10.0.x + - name: Set up Go ${{ env.GOVER }} + if: matrix.lang == 'go' + uses: actions/setup-go@v7 + with: + go-version: ${{ env.GOVER }} + cache: false + - name: Set up OpenJDK 17 + if: matrix.lang == 'java' + uses: actions/setup-java@v6 + with: + distribution: 'temurin' + java-version: 17 + - name: Set up Dapr CLI + run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }} + - name: Install the Dapr binaries + # Java tutorials start Dapr with Testcontainers and need no local Dapr runtime. + if: matrix.lang != 'java' + run: | + export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + dapr init --slim --runtime-version=${{ env.DAPR_RUNTIME_VERSION }} + dapr --version + - name: Start the Scheduler and Placement services + # The commands of "Run the tutorials without Docker" in the language README. + if: matrix.lang != 'java' + run: | + mkdir -p "$RUNNER_TEMP/scheduler-data" + nohup "$HOME/.dapr/bin/scheduler" --etcd-data-dir "$RUNNER_TEMP/scheduler-data" > "$RUNNER_TEMP/scheduler.log" 2>&1 & + nohup "$HOME/.dapr/bin/placement" --healthz-port 8081 --metrics-port 9091 > "$RUNNER_TEMP/placement.log" 2>&1 & + for port in 8080 8081; do + curl --silent --fail --retry 30 --retry-connrefused --retry-delay 1 "http://localhost:$port/healthz" > /dev/null + done + - name: Validate workflow/${{ matrix.lang }}/${{ matrix.topic }} + run: bash tutorials/workflow/validate.sh ${{ matrix.lang }} ${{ matrix.topic }} diff --git a/CLAUDE.md b/CLAUDE.md index deabba1e1..b334791fa 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -112,7 +112,7 @@ When adding code, hold to the patterns already present across the repo (browse a Workflows in `.github/workflows/validate__quickstarts.yaml` run on PRs to `master`/`release-*`. Each installs the pinned Dapr CLI/runtime from `.github/env/global.env`, the language toolchain, and `mechanical-markdown`, then loops the building-block quickstarts running `make validate`. To reproduce a CI failure locally, `cd` into the failing quickstart directory and run `make validate`. The repo-root `make validate` link-checks the top-level `README.md`. -`validate_tutorials.yaml` covers tutorials, but only `hello-world` and `hello-kubernetes` are actually enabled — the rest (including **all** of `tutorials/workflow/*`) are commented out because mechanical-markdown can't drive their long-running services. **Treat the workflow tutorials as untested by CI: validate them manually before relying on them.** +`validate_tutorials.yaml` covers tutorials. The `hello-world` and `hello-kubernetes` jobs run the README with mechanical-markdown. The workflow tutorials (`tutorials/workflow/*`) run in a matrix job through `tutorials/workflow/validate.sh `, because mechanical-markdown cannot drive their long-running services: the script starts the tutorial, sends the requests of its `.http` file and checks the status of each workflow instance. To reproduce a failure locally, run the same script from the repo root. ## Contributing constraints diff --git a/tutorials/workflow/csharp/README.md b/tutorials/workflow/csharp/README.md index 434b12e1f..ba3895c31 100644 --- a/tutorials/workflow/csharp/README.md +++ b/tutorials/workflow/csharp/README.md @@ -41,7 +41,7 @@ By default, the tutorials use Redis in Docker as the workflow state store, and t Use this option when Docker is not available or not allowed, for example on a locked-down laptop, in a CI job, or in a dev container without Docker. It also starts faster, because it has fewer moving parts. -The [Combined Patterns](./combined-patterns/README.md) tutorial also uses Redis for pub/sub, so it does not run this way. The [History Propagation](./history-propagation/README.md) and Versioning tutorials do not have a `dapr-sqlite.yaml` file. The commands are for Linux and macOS, and for Windows (PowerShell). +The [Combined Patterns](./combined-patterns/README.md) tutorial also uses Redis for pub/sub, so it does not run this way. The commands are for Linux and macOS, and for Windows (PowerShell). 1. Install the Dapr binaries. This command installs `daprd`, `placement`, and `scheduler` in `$HOME/.dapr/bin` (`$env:USERPROFILE\.dapr\bin` on Windows, with the `.exe` extension). It does not start them. diff --git a/tutorials/workflow/csharp/history-propagation/dapr-sqlite.yaml b/tutorials/workflow/csharp/history-propagation/dapr-sqlite.yaml new file mode 100644 index 000000000..976b8787c --- /dev/null +++ b/tutorials/workflow/csharp/history-propagation/dapr-sqlite.yaml @@ -0,0 +1,7 @@ +version: 1 +common: + resourcesPath: ../../resources-sqlite +apps: + - appID: patient-intake + appDirPath: ./patient-intake/ + command: ["dotnet", "run"] diff --git a/tutorials/workflow/csharp/versioning/Versioning/dapr-sqlite.yaml b/tutorials/workflow/csharp/versioning/Versioning/dapr-sqlite.yaml new file mode 100644 index 000000000..e0c858d5b --- /dev/null +++ b/tutorials/workflow/csharp/versioning/Versioning/dapr-sqlite.yaml @@ -0,0 +1,12 @@ +version: 1 +common: + resourcesPath: ../../../resources-sqlite +apps: + - appID: workflow-versioning + appDirPath: ./ + appPort: 5087 + daprHTTPPort: 3500 + daprGRPCPort: 50001 + command: ["dotnet", "run"] + appLogDestination: console + daprdLogDestination: console diff --git a/tutorials/workflow/csharp/versioning/Versioning/versioning.http b/tutorials/workflow/csharp/versioning/Versioning/versioning.http new file mode 100644 index 000000000..95c7fad4a --- /dev/null +++ b/tutorials/workflow/csharp/versioning/Versioning/versioning.http @@ -0,0 +1,10 @@ +@apphost=http://localhost:5087 + +### Start the NotifyUserWorkflow workflow +# @name startWorkflowRequest +GET {{ apphost }}/start + +### Get the workflow status +@instanceId={{startWorkflowRequest.response.body.*}} +@daprHost=http://localhost:3500 +GET {{ daprHost }}/v1.0/workflows/dapr/{{ instanceId }} diff --git a/tutorials/workflow/validate.sh b/tutorials/workflow/validate.sh new file mode 100755 index 000000000..6710d3c50 --- /dev/null +++ b/tutorials/workflow/validate.sh @@ -0,0 +1,568 @@ +#!/usr/bin/env bash +# +# Copyright 2026 The Dapr Authors +# 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. +# +# Usage: tutorials/workflow/validate.sh +# python | csharp | go | java +# a folder name under tutorials/workflow/, for example fundamentals +# +# What it does: +# 1. Builds the tutorial (python: uv venv + uv pip install, csharp: dotnet build, go: go build). +# 2. Starts it. python, csharp and go: `dapr run -f `. java: `mvn spring-boot:test-run`. +# 3. Sends the requests of the topic's .http file, in order. It reads the `@var = value` lines, +# the `###` request blocks, the `# @name` names, and the `{{var}}`, `{{$guid}}`, +# `{{name.response.headers.X}}` and `{{name.response.body.}}` references. +# 4. Checks every instance that a request started through GET /v1.0/workflows/dapr/. +# An instance must reach COMPLETED. An instance that the .http file purges must be COMPLETED +# before the purge (TERMINATED when the file terminates it first), and after the purge a +# daprd must answer that it does not know the instance. +# 5. Stops everything that it started and prints one RESULT line per instance. +# history-propagation has no .http file: the app runs its scenarios and exits, and the script +# checks the app output. Any other topic must have a .http file. +# +# It does not start the Dapr control plane. Before a python, csharp or go topic, the Scheduler and +# Placement services must run (the "Run the tutorials without Docker" section of the language +# README starts them) and, for combined-patterns, Redis on localhost:6379. +# Java topics start their own Dapr with Testcontainers and need a running Docker daemon. +# The script needs bash, curl and python3. It runs on Linux and macOS. +# +# Environment: +# VALIDATE_RUN_FILE force the run file (default: dapr-sqlite.yaml when present, otherwise dapr.yaml) +# VALIDATE_TIMEOUT seconds that an instance may take to reach COMPLETED (default 180) +# VALIDATE_LOG_DIR where the app logs go (default: a new temporary folder) +# Exit code: 0 when every instance passes, 1 when one fails, 2 for a usage error. + +set -u + +LANG_=${1:-} +TOPIC=${2:-} +[ -n "$LANG_" ] && [ -n "$TOPIC" ] || { echo "usage: $0 " >&2; exit 2; } + +HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +DIR=$HERE/$LANG_/$TOPIC +[ -d "$DIR" ] || { echo "no such folder: $DIR" >&2; exit 2; } +TIMEOUT=${VALIDATE_TIMEOUT:-180} +LOGDIR=${VALIDATE_LOG_DIR:-$(mktemp -d "${TMPDIR:-/tmp}/validate-$LANG_-$TOPIC.XXXXXX")} +mkdir -p "$LOGDIR" + +say() { echo "[validate] $*"; } +fail() { say "FAIL: $*"; exit 1; } + +# One process group per started app, so that cleanup stops the children too. +PIDS=() +TC_BEFORE="" # java: the Testcontainers containers that existed before this run +TC_PROPS_BACKUP="" # java: set when this run changed ~/.testcontainers.properties +cleanup() { + local p + for p in "${PIDS[@]:-}"; do [ -n "$p" ] && kill -INT -- "-$p" 2>/dev/null; done + for _ in $(seq 1 20); do + local alive=0 + for p in "${PIDS[@]:-}"; do [ -n "$p" ] && kill -0 "$p" 2>/dev/null && alive=1; done + [ "$alive" = 0 ] && break + sleep 0.5 + done + for p in "${PIDS[@]:-}"; do [ -n "$p" ] && kill -9 -- "-$p" 2>/dev/null; done + if [ "$LANG_" = java ] && command -v docker > /dev/null 2>&1; then + # Remove only the Testcontainers containers that this run created. + local c + c=$(comm -13 <(printf '%s\n' "$TC_BEFORE" | sort) \ + <(docker ps -aq --no-trunc --filter label=org.testcontainers=true 2>/dev/null | sort)) + [ -n "$c" ] && docker rm -f $c > /dev/null 2>&1 + fi + # Undo the Testcontainers reuse setting that this run added. + case "$TC_PROPS_BACKUP" in + "") ;; + none) rm -f "$HOME/.testcontainers.properties" ;; + *) cp "$TC_PROPS_BACKUP" "$HOME/.testcontainers.properties" ;; + esac + return 0 +} +trap cleanup EXIT +trap 'exit 130' INT TERM + +# start : run a command in its own process group, log to $LOGDIR/.log. +# macOS has no setsid command. There, python3 (which this script needs anyway) starts the session. +if command -v setsid > /dev/null 2>&1; then + new_session() { exec setsid "$@"; } +else + new_session() { exec python3 -c 'import os, sys; os.setsid(); os.execvp(sys.argv[1], sys.argv[1:])' "$@"; } +fi +start() { + local name=$1 dir=$2; shift 2 + say "start $name in ${dir#$HERE/}: $*" + ( cd "$dir" && new_session "$@" ) > "$LOGDIR/$name.log" 2>&1 < /dev/null & + PIDS+=("$!") +} + +wait_port() { # wait_port + local end=$(( $(date +%s) + $2 )) + while [ "$(date +%s)" -lt "$end" ]; do + (exec 3<>"/dev/tcp/127.0.0.1/$1") 2>/dev/null && return 0 + for pid in "${PIDS[@]:-}"; do [ -n "$pid" ] && ! kill -0 "$pid" 2>/dev/null && return 1; done + sleep 0.5 + done + return 1 +} +wait_healthz() { # wait_healthz + local end=$(( $(date +%s) + $2 )) code + while [ "$(date +%s)" -lt "$end" ]; do + code=$(curl -s -o /dev/null -m 3 -w '%{http_code}' "http://localhost:$1/v1.0/healthz") + case "$code" in 2*) return 0;; esac + sleep 0.5 + done + return 1 +} +show_logs() { + local f + for f in "$LOGDIR"/*.log; do [ -f "$f" ] && { say "--- tail of $f"; tail -n 40 "$f"; }; done +} + +# --- Find the run folder. csharp/versioning keeps its files in a Versioning subfolder. +APP=$DIR +if [ ! -f "$APP/dapr.yaml" ] && [ "$LANG_" != java ]; then + nested=$(find "$DIR" -mindepth 2 -maxdepth 2 -name dapr.yaml -print | head -n 2) + [ "$(echo "$nested" | wc -l)" = 1 ] && [ -n "$nested" ] && APP=$(dirname "$nested") +fi + +HTTP_FILE=$(find "$APP" -maxdepth 1 -name '*.http' -print | head -n 1) +[ -z "$HTTP_FILE" ] && HTTP_FILE=$(find "$APP" -maxdepth 2 -name '*.http' -print | head -n 1) + +# --- Build, then start. +APP_PORTS="" +DAPR_PORTS="" +case "$LANG_" in + python) + reqs="" + for r in $(find "$APP" -maxdepth 2 -name requirements.txt | sort); do reqs="$reqs -r $r"; done + [ -n "$reqs" ] || fail "no requirements.txt under $APP" + ( cd "$APP" && uv venv && uv pip install $reqs ) > "$LOGDIR/build.log" 2>&1 || { show_logs; fail "uv venv or uv pip install failed"; } + ;; + csharp) + for p in $(find "$APP" -maxdepth 2 -name '*.csproj' | sort); do + ( cd "$(dirname "$p")" && dotnet build ) > "$LOGDIR/build-$(basename "$p").log" 2>&1 || { show_logs; fail "dotnet build failed for $p"; } + done + ;; + go) + ( cd "$APP" && go build ./... ) > "$LOGDIR/build.log" 2>&1 || { show_logs; fail "go build failed"; } + ;; +esac + +if [ "$LANG_" = java ]; then + if command -v docker > /dev/null 2>&1; then + TC_BEFORE=$(docker ps -aq --no-trunc --filter label=org.testcontainers=true 2>/dev/null) + fi + if [ -d "$APP/workflow-app" ] && [ -d "$APP/shipping-app" ]; then + # The README of combined-patterns: reuse the Testcontainers Dapr containers across the two apps. + # The setting is for this run only: cleanup puts the user's file back. + if ! grep -qs 'testcontainers.reuse.enable=true' "$HOME/.testcontainers.properties"; then + if [ -f "$HOME/.testcontainers.properties" ]; then + TC_PROPS_BACKUP=$LOGDIR/testcontainers.properties.orig + cp "$HOME/.testcontainers.properties" "$TC_PROPS_BACKUP" + else + TC_PROPS_BACKUP=none + fi + echo 'testcontainers.reuse.enable=true' >> "$HOME/.testcontainers.properties" + fi + # Start the second app after the first one is up, as the README does: both apps create the + # same Testcontainers network and Redis container. + start workflow-app "$APP/workflow-app" mvn clean -Dspring-boot.run.arguments="--reuse=true" spring-boot:test-run + wait_port 8080 900 || { show_logs; fail "app port 8080 did not open in 900 s"; } + start shipping-app "$APP/shipping-app" mvn clean -Dspring-boot.run.arguments="--reuse=true" spring-boot:test-run + APP_PORTS="8080 8081" + else + start app "$APP" mvn spring-boot:test-run + APP_PORTS="8080" + fi + DAPR_PORTS=docker + WAIT=900 +else + RUN_FILE=${VALIDATE_RUN_FILE:-} + if [ -z "$RUN_FILE" ]; then + if [ -f "$APP/dapr-sqlite.yaml" ]; then RUN_FILE=dapr-sqlite.yaml; else RUN_FILE=dapr.yaml; fi + fi + [ -f "$APP/$RUN_FILE" ] || fail "no run file $APP/$RUN_FILE" + APP_PORTS=$(sed -n 's/^[[:space:]]*appPort:[[:space:]]*\([0-9]*\).*/\1/p' "$APP/$RUN_FILE" | tr '\n' ' ') + DAPR_PORTS=$(sed -n 's/^[[:space:]]*daprHTTPPort:[[:space:]]*\([0-9]*\).*/\1/p' "$APP/$RUN_FILE" | paste -sd, -) + if [ "$LANG_" = python ]; then + start app "$APP" uv run dapr run -f "$RUN_FILE" + else + start app "$APP" dapr run -f "$RUN_FILE" + fi + WAIT=180 +fi + +# --- history-propagation has no .http file: the app runs its scenarios and exits. +# The expected output lines below belong to that topic only. +if [ -z "$HTTP_FILE" ]; then + [ "$TOPIC" = history-propagation ] || fail "no .http file in ${APP#$HERE/}, and no expected app output is defined for $TOPIC" + say "no .http file in ${APP#$HERE/}: checking the app output" + APPLOG=$LOGDIR/app.log + end=$(( $(date +%s) + 300 )) + while [ "$(date +%s)" -lt "$end" ]; do + grep -q 'SCENARIO 2' "$APPLOG" 2>/dev/null && grep -qE 'REFUSED' "$APPLOG" 2>/dev/null && break + kill -0 "${PIDS[0]}" 2>/dev/null || break + sleep 1 + done + sleep 2 + rc=0 + check() { # check