github.com/IBM-Blockchain/fabric-operator@v1.0.4/scripts/run-unit-tests.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright contributors to the Hyperledger Fabric Operator project
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  # Licensed under the Apache License, Version 2.0 (the "License");
     8  # you may not use this file except in compliance with the License.
     9  # You may obtain a copy of the License at:
    10  #
    11  # 	  http://www.apache.org/licenses/LICENSE-2.0
    12  #
    13  # Unless required by applicable law or agreed to in writing, software
    14  # distributed under the License is distributed on an "AS IS" BASIS,
    15  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16  # See the License for the specific language governing permissions and
    17  # limitations under the License.
    18  #
    19  
    20  echo "Running unit tests..."
    21  
    22  export PATH=$PATH:$GOPATH/bin
    23  
    24  # List of packages to not run test for
    25  EXCLUDED_PKGS=(
    26      "/mocks"
    27      "/manager$"
    28      "/manager/resources$"
    29      "/apis"
    30      "/controller$"
    31      "/controllers$"
    32      "ibp-operator/config$"
    33      "/integration"
    34  )
    35  
    36  PKGS=`go list ./... | grep -v -f <(printf '%s\n' "${EXCLUDED_PKGS[@]}")`
    37  
    38  go test $PKGS -cover
    39  exit $?