ci_e2e_4am.sh 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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_HOST=$(kubectl get svc ${MILVUS_SERVICE_NAME}-milvus -n ${MILVUS_HELM_NAMESPACE} -o jsonpath='{.spec.clusterIP}')
  37. MILVUS_SERVICE_PORT="19530"
  38. # Minio service name
  39. MINIO_SERVICE_NAME=$(echo "${MILVUS_HELM_RELEASE_NAME}-minio.${MILVUS_HELM_NAMESPACE}" | tr -d '\n')
  40. # Shellcheck source=ci-util.sh
  41. source "${ROOT}/tests/scripts/ci-util-4am.sh"
  42. cd ${ROOT}/tests/python_client
  43. # Print python3 version, python version 3.6.8 is more stable for test
  44. python3 -V
  45. # Pytest will try to get ${CI_LOG_PATH} from environment variables first,then use default path
  46. export CI_LOG_PATH=/tmp/ci_logs/test
  47. if [ ! -d "${CI_LOG_PATH}" ]; then
  48. # Create dir for ci log path when it does not exist
  49. mkdir -p ${CI_LOG_PATH}
  50. fi
  51. # skip pip install when DISABLE_PIP_INSTALL is set
  52. DISABLE_PIP_INSTALL=${DISABLE_PIP_INSTALL:-false}
  53. if [ "${DISABLE_PIP_INSTALL:-}" = "false" ]; then
  54. echo "prepare e2e test"
  55. install_pytest_requirements
  56. fi
  57. cd ${ROOT}/tests/python_client
  58. # Run bulk insert test
  59. # if MILVUS_HELM_RELEASE_NAME contains "msop", then it is one pod mode, skip the bulk insert test
  60. if [[ "${MILVUS_HELM_RELEASE_NAME}" != *"msop"* ]]; then
  61. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  62. timeout "${TEST_TIMEOUT}" pytest testcases/test_bulk_insert.py --timeout=300 -v -x -n 6 --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} \
  63. --html=${CI_LOG_PATH}/report_bulk_insert.html --self-contained-html
  64. else
  65. pytest testcases/test_bulk_insert.py --timeout=300 -v -x -n 6 --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} \
  66. --html=${CI_LOG_PATH}/report_bulk_insert.html --self-contained-html
  67. fi
  68. fi
  69. # Run restful test v1
  70. cd ${ROOT}/tests/restful_client
  71. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  72. timeout "${TEST_TIMEOUT}" pytest testcases --endpoint http://${MILVUS_SERVICE_NAME}:${MILVUS_SERVICE_PORT} -v -x -m L0 -n 6 --timeout 180\
  73. --html=${CI_LOG_PATH}/report_restful.html --self-contained-html
  74. else
  75. pytest testcases --endpoint http://${MILVUS_SERVICE_NAME}:${MILVUS_SERVICE_PORT} -v -x -m L0 -n 6 --timeout 180\
  76. --html=${CI_LOG_PATH}/report_restful.html --self-contained-html
  77. fi
  78. # Run restful test v2
  79. cd ${ROOT}/tests/restful_client_v2
  80. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  81. timeout "${TEST_TIMEOUT}" pytest testcases --endpoint http://${MILVUS_SERVICE_NAME}:${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} -v -x -m L0 -n 6 --timeout 240\
  82. --html=${CI_LOG_PATH}/report_restful.html --self-contained-html
  83. else
  84. pytest testcases --endpoint http://${MILVUS_SERVICE_NAME}:${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} -v -x -m L0 -n 6 --timeout 240\
  85. --html=${CI_LOG_PATH}/report_restful.html --self-contained-html
  86. fi
  87. if [[ "${MILVUS_HELM_RELEASE_NAME}" != *"msop"* ]]; then
  88. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  89. timeout "${TEST_TIMEOUT}" pytest testcases --endpoint http://${MILVUS_SERVICE_NAME}:${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} -v -x -m BulkInsert -n 6 --timeout 240\
  90. --html=${CI_LOG_PATH}/report_restful.html --self-contained-html
  91. else
  92. pytest testcases --endpoint http://${MILVUS_SERVICE_NAME}:${MILVUS_SERVICE_PORT} --minio_host ${MINIO_SERVICE_NAME} -v -x -m BulkInsert -n 6 --timeout 240\
  93. --html=${CI_LOG_PATH}/report_restful.html --self-contained-html
  94. fi
  95. fi
  96. cd ${ROOT}/tests/python_client
  97. # Pytest is not able to have both --timeout & --workers, so do not add --timeout or --workers in the shell script
  98. if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  99. timeout "${TEST_TIMEOUT}" pytest --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} \
  100. --html=${CI_LOG_PATH}/report.html --self-contained-html --dist loadgroup ${@:-}
  101. else
  102. pytest --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} \
  103. --html=${CI_LOG_PATH}/report.html --self-contained-html --dist loadgroup ${@:-}
  104. fi
  105. # # Run concurrent test with 5 processes
  106. # if [[ -n "${TEST_TIMEOUT:-}" ]]; then
  107. # timeout "${TEST_TIMEOUT}" pytest testcases/test_concurrent.py --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} --count 5 -n 5 \
  108. # --html=${CI_LOG_PATH}/report_concurrent.html --self-contained-html
  109. # else
  110. # pytest testcases/test_concurrent.py --host ${MILVUS_SERVICE_NAME} --port ${MILVUS_SERVICE_PORT} --count 5 -n 5 \
  111. # --html=${CI_LOG_PATH}/report_concurrent.html --self-contained-html
  112. # fi