sigs.k8s.io/azuredisk-csi-driver@v1.30.1/test/sanity/run-test.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2020 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 -euo pipefail
    18  
    19  function cleanup {
    20    echo 'pkill -f azurediskplugin'
    21    pkill -f azurediskplugin
    22    echo 'Deleting CSI sanity test binary'
    23    rm -rf csi-test
    24  }
    25  
    26  trap cleanup EXIT
    27  
    28  readonly endpoint='unix:///tmp/csi.sock'
    29  nodeid='CSINode'
    30  if [[ "$#" -gt 0 ]] && [[ -n "$1" ]]; then
    31    nodeid="$1"
    32  fi
    33  
    34  ARCH=$(uname -p)
    35  if [[ "${ARCH}" == "x86_64" || ${ARCH} == "unknown" ]]; then
    36    ARCH="amd64"
    37  fi
    38  
    39  if [[ "$#" -lt 2 || "$2" != "v2" ]]; then
    40    _output/${ARCH}/azurediskplugin --endpoint "$endpoint" --nodeid "$nodeid" -v=5 -support-zone=false -enable-disk-capacity-check=true &
    41  else
    42    _output/${ARCH}/azurediskpluginv2 --endpoint "$endpoint" --nodeid "$nodeid" -v=5 -support-zone=false -enable-disk-capacity-check=true &
    43  fi
    44  
    45  # sleep a while waiting for azurediskplugin start up
    46  sleep 1
    47  
    48  echo 'Begin to run sanity test...'
    49  readonly CSI_SANITY_BIN='csi-sanity'
    50  "$CSI_SANITY_BIN" --ginkgo.v --csi.endpoint="$endpoint" --ginkgo.skip='should work|should fail when volume does not exist on the specified path|should be idempotent|pagination should detect volumes added between pages and accept tokens when the last volume from a page is deleted|should remove target path'