run_intergration_test.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. # Licensed to the LF AI & Data foundation under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # run integration test
  18. echo "Running integration test under ./tests/integration"
  19. FILE_COVERAGE_INFO="it_coverage.txt"
  20. BASEDIR=$(dirname "$0")
  21. source $BASEDIR/setenv.sh
  22. TEST_CMD=$@
  23. if [ -z "$TEST_CMD" ]; then
  24. TEST_CMD="go test"
  25. fi
  26. set -e
  27. echo "mode: atomic" > ${FILE_COVERAGE_INFO}
  28. # starting the timer
  29. beginTime=`date +%s`
  30. for d in $(go list ./tests/integration/...); do
  31. echo "Start to run integration test under \"$d\" pkg"
  32. if [[ $d == *"coordrecovery"* ]]; then
  33. echo "running coordrecovery"
  34. # simplified command to speed up coord init test since it is large.
  35. $TEST_CMD -tags dynamic,test -v -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=20m -timeout=30m
  36. else
  37. $TEST_CMD -race -tags dynamic,test -v -coverpkg=./... -coverprofile=profile.out -covermode=atomic "$d" -caseTimeout=15m -timeout=30m
  38. fi
  39. if [ -f profile.out ]; then
  40. grep -v kafka profile.out | grep -v planparserv2/generated | grep -v mocks | sed '1d' >> ${FILE_COVERAGE_INFO}
  41. rm profile.out
  42. fi
  43. done
  44. endTime=`date +%s`
  45. echo "Total time for go integration test:" $(($endTime-$beginTime)) "s"