github.com/argoproj/argo-events@v1.9.1/hack/e2e/setup-e2e.sh (about)

     1  #!/bin/bash
     2  
     3  set -e
     4  
     5  PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/../..; pwd)
     6  
     7  if [[ -z "$E2E_ID" ]]; then
     8    E2E_ID="argo-events-e2e"
     9  fi
    10  
    11  echo "* Set up e2e test $E2E_ID"
    12  
    13  kubectl apply -f $PROJECT_ROOT/hack/k8s/manifests/gateway-crd.yaml
    14  kubectl apply -f $PROJECT_ROOT/hack/k8s/manifests/sensor-crd.yaml
    15  
    16  echo "* Creating the e2e environment..."
    17  kubectl apply -f - << EOS
    18  apiVersion: v1
    19  kind: Namespace
    20  metadata:
    21    name: "$E2E_ID"
    22    labels:
    23      argo-events-e2e: "$E2E_ID"
    24  EOS
    25  
    26  # ls $PROJECT_ROOT/hack/e2e/manifests/* | xargs -I {} sed -e "s|E2E_ID|$E2E_ID|g" {} | kubectl apply -f -
    27  manifests=$(ls $PROJECT_ROOT/hack/e2e/manifests/*)
    28  for m in $manifests; do
    29    sed -e "s|E2E_ID|$E2E_ID|g" $m | kubectl apply -f -
    30  done
    31  
    32  # wait for controllers up
    33  echo "* Wait for controllers startup..."
    34  sleep 3
    35  for i in {1..60}; do
    36    pods_cnt=$(kubectl get pod -n "$E2E_ID" --no-headers --field-selector "status.phase=Running" 2> /dev/null | wc -l | xargs)
    37    if [[ $pods_cnt -eq 2 ]]; then
    38      break
    39    fi
    40    if [[ $i -eq 60 ]]; then
    41      echo "* The controllers didn't start up within the time limit."
    42      exit 1
    43    fi
    44    sleep 1
    45  done