github.com/vipernet-xyz/tm@v0.34.24/test/e2e/run-multiple.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # This is a convenience script that takes a list of testnet manifests
     4  # as arguments and runs each one of them sequentially. If a testnet
     5  # fails, the container logs are dumped to stdout along with the testnet
     6  # manifest, but the remaining testnets are still run.
     7  #
     8  # This is mostly used to run generated networks in nightly CI jobs.
     9  #
    10  
    11  set -euo pipefail
    12  
    13  if [[ $# == 0 ]]; then
    14  	echo "Usage: $0 [MANIFEST...]" >&2
    15  	exit 1
    16  fi
    17  
    18  FAILED=()
    19  
    20  for MANIFEST in "$@"; do
    21  	START=$SECONDS
    22  	echo "==> Running testnet $MANIFEST..."
    23  
    24  	if ! ./build/runner -f "$MANIFEST"; then
    25  		echo "==> Testnet $MANIFEST failed, dumping manifest..."
    26  		cat "$MANIFEST"
    27  
    28  		echo "==> Dumping container logs for $MANIFEST..."
    29  		./build/runner -f "$MANIFEST" logs
    30  
    31  		echo "==> Cleaning up failed testnet $MANIFEST..."
    32  		./build/runner -f "$MANIFEST" cleanup
    33  
    34  		FAILED+=("$MANIFEST")
    35  	fi
    36  
    37  	echo "==> Completed testnet $MANIFEST in $(( SECONDS - START ))s"
    38  	echo ""
    39  done
    40  
    41  if [[ ${#FAILED[@]} -ne 0 ]]; then
    42  	echo "${#FAILED[@]} testnets failed:"
    43  	for MANIFEST in "${FAILED[@]}"; do
    44  		echo "- $MANIFEST"
    45  	done
    46  	exit 1
    47  else
    48  	echo "All testnets successful"
    49  fi