sigs.k8s.io/kueue@v0.6.2/hack/e2e-test.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright 2022 The Kubernetes Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  set -o errexit
    18  set -o nounset
    19  set -o pipefail
    20  
    21  SOURCE_DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
    22  ROOT_DIR=$SOURCE_DIR/..
    23  export KUSTOMIZE=$ROOT_DIR/bin/kustomize
    24  export GINKGO=$ROOT_DIR/bin/ginkgo
    25  export KIND=$ROOT_DIR/bin/kind
    26  export E2E_TEST_IMAGE=gcr.io/k8s-staging-perf-tests/sleep:v0.1.0
    27  
    28  source ${SOURCE_DIR}/e2e-common.sh
    29  
    30  function cleanup {
    31      if [ $CREATE_KIND_CLUSTER == 'true' ]
    32      then
    33          if [ ! -d "$ARTIFACTS" ]; then
    34              mkdir -p "$ARTIFACTS"
    35          fi
    36  	cluster_cleanup $KIND_CLUSTER_NAME
    37      fi
    38      #do the image restore here for the case when an error happened during deploy
    39      restore_managers_image
    40  }
    41  
    42  function startup {
    43      if [ $CREATE_KIND_CLUSTER == 'true' ]
    44      then
    45          if [ ! -d "$ARTIFACTS" ]; then
    46              mkdir -p "$ARTIFACTS"
    47          fi
    48  	cluster_create $KIND_CLUSTER_NAME  $SOURCE_DIR/kind-cluster.yaml 
    49      fi
    50  }
    51  
    52  function kind_load {
    53      if [ $CREATE_KIND_CLUSTER == 'true' ]
    54      then
    55          docker pull $E2E_TEST_IMAGE
    56  	cluster_kind_load $KIND_CLUSTER_NAME
    57      fi
    58  }
    59  
    60  function kueue_deploy {
    61      (cd config/components/manager && $KUSTOMIZE edit set image controller=$IMAGE_TAG)
    62      cluster_kueue_deploy $KIND_CLUSTER_NAME
    63  }
    64  
    65  trap cleanup EXIT
    66  startup
    67  kind_load
    68  kueue_deploy
    69  $GINKGO $GINKGO_ARGS --junit-report=junit.xml --output-dir=$ARTIFACTS -v ./test/e2e/singlecluster/...