ci_e2e.sh 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/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. SOURCE="${BASH_SOURCE[0]}"
  18. while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  19. DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  20. SOURCE="$(readlink "$SOURCE")"
  21. [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
  22. done
  23. ROOT="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )"
  24. # Exit immediately for non zero status
  25. set -e
  26. # Check unset variables
  27. set -u
  28. # Print commands
  29. set -x
  30. MILVUS_HELM_RELEASE_NAME="${MILVUS_HELM_RELEASE_NAME:-milvus-testing}"
  31. MILVUS_CLUSTER_ENABLED="${MILVUS_CLUSTER_ENABLED:-false}"
  32. MILVUS_HELM_NAMESPACE="${MILVUS_HELM_NAMESPACE:-default}"
  33. PARALLEL_NUM="${PARALLEL_NUM:-6}"
  34. # Use service name instead of IP to test
  35. MILVUS_SERVICE_NAME=$(echo "${MILVUS_HELM_RELEASE_NAME}-milvus.${MILVUS_HELM_NAMESPACE}" | tr -d '\n')
  36. MILVUS_SERVICE_PORT="19530"
  37. # Minio service name
  38. MINIO_SERVICE_NAME=$(echo "${MILVUS_HELM_RELEASE_NAME}-minio.${MILVUS_HELM_NAMESPACE}" | tr -d '\n')
  39. # Shellcheck source=ci-util.sh
  40. source "${ROOT}/tests/scripts/ci-util.sh"
  41. cd ${ROOT}/tests/python_client
  42. # Print python3 version, python version 3.6.8 is more stable for test
  43. python3 -V
  44. # Pytest will try to get ${CI_LOG_PATH} from environment variables first,then use default path
  45. export CI_LOG_PATH=/tmp/ci_logs/test
  46. if [ ! -d "${CI_LOG_PATH}" ]; then
  47. # Create dir for ci log path when it does not exist
  48. mkdir -p ${CI_LOG_PATH}
  49. fi
  50. # skip pip install when DISABLE_PIP_INSTALL is set
  51. if [ "${DISABLE_PIP_INSTALL:-}" = "" ]; then
  52. echo "prepare e2e test"
  53. install_pytest_requirements
  54. fi
  55. if [[ "${MILVUS_HELM_RELEASE_NAME}" != *"msop"* ]]; then
  56. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  57. timeout "${TEST_TIMEOUT}" pytest testcases/test_bulk_insert.py --timeout=300 --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} \
  58. --html=${CI_LOG_PATH}/report_bulk_insert.html --self-contained-html
  59. else
  60. pytest testcases/test_bulk_insert.py --timeout=300 --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} \
  61. --html=${CI_LOG_PATH}/report_bulk_insert.html --self-contained-html
  62. fi
  63. fi
  64. # Pytest is not able to have both --timeout & --workers, so do not add --timeout or --workers in the shell script
  65. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  66. timeout "${TEST_TIMEOUT}" pytest --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} \
  67. --html=${CI_LOG_PATH}/report.html --self-contained-html ${@:-}
  68. else
  69. pytest --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} \
  70. --html=${CI_LOG_PATH}/report.html --self-contained-html ${@:-}
  71. fi