2021-11-24 16:13:15 +08:00
#!/bin/bash
2022-01-07 09:53:22 +08:00
# Licensed to the LF AI & Data foundation under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
2022-01-06 13:30:38 +08:00
# with the License. You may obtain a copy of the License at
2021-11-24 16:13:15 +08:00
#
2022-01-07 09:53:22 +08:00
# http://www.apache.org/licenses/LICENSE-2.0
2021-11-24 16:13:15 +08:00
#
2022-01-07 09:53:22 +08:00
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2021-11-24 16:13:15 +08:00
SOURCE = " ${ BASH_SOURCE [0] } "
while [ -h " $SOURCE " ] ; do # resolve $SOURCE until the file is no longer a symlink
DIR = " $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
SOURCE = " $( readlink " $SOURCE " ) "
[ [ $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
done
ROOT = " $( cd -P " $( dirname " $SOURCE " ) /../.. " && pwd ) "
2021-11-30 14:20:23 +08:00
# Exit immediately for non zero status
2021-11-24 16:13:15 +08:00
set -e
2021-12-02 13:01:37 +08:00
# Check unset variables
2021-11-24 16:13:15 +08:00
set -u
2021-12-03 13:24:18 +08:00
# Print commands
2021-11-24 16:13:15 +08:00
set -x
MILVUS_HELM_RELEASE_NAME = " ${ MILVUS_HELM_RELEASE_NAME :- milvus -testing } "
MILVUS_CLUSTER_ENABLED = " ${ MILVUS_CLUSTER_ENABLED :- false } "
MILVUS_HELM_NAMESPACE = " ${ MILVUS_HELM_NAMESPACE :- default } "
PARALLEL_NUM = " ${ PARALLEL_NUM :- 6 } "
2021-12-30 14:19:18 +08:00
# Use service name instead of IP to test
2021-12-31 14:14:17 +08:00
MILVUS_SERVICE_NAME = $( echo " ${ MILVUS_HELM_RELEASE_NAME } -milvus. ${ MILVUS_HELM_NAMESPACE } " | tr -d '\n' )
2021-11-24 16:13:15 +08:00
MILVUS_SERVICE_PORT = "19530"
2023-05-24 15:27:26 +08:00
# Minio service name
MINIO_SERVICE_NAME = $( echo " ${ MILVUS_HELM_RELEASE_NAME } -minio. ${ MILVUS_HELM_NAMESPACE } " | tr -d '\n' )
2021-11-24 16:13:15 +08:00
2021-12-30 14:19:18 +08:00
# Shellcheck source=ci-util.sh
2021-11-24 16:13:15 +08:00
source " ${ ROOT } /tests/scripts/ci-util.sh "
cd ${ ROOT } /tests/python_client
2021-12-01 10:41:34 +08:00
2021-12-30 14:19:18 +08:00
# Print python3 version, python version 3.6.8 is more stable for test
2021-11-24 16:13:15 +08:00
python3 -V
2021-12-07 09:39:54 +08:00
2021-12-30 14:19:18 +08:00
# Pytest will try to get ${CI_LOG_PATH} from environment variables first,then use default path
2021-12-01 15:49:31 +08:00
export CI_LOG_PATH = /tmp/ci_logs/test
2021-12-01 10:41:34 +08:00
2021-11-24 16:13:15 +08:00
if [ ! -d " ${ CI_LOG_PATH } " ] ; then
2021-12-30 14:19:18 +08:00
# Create dir for ci log path when it does not exist
2021-12-13 13:20:03 +08:00
mkdir -p ${ CI_LOG_PATH }
2021-11-24 16:13:15 +08:00
fi
2022-01-05 09:41:32 +08:00
echo "prepare e2e test"
install_pytest_requirements
2021-11-24 16:13:15 +08:00
2021-12-29 11:52:48 +08:00
2022-01-04 19:09:37 +08:00
# Pytest is not able to have both --timeout & --workers, so do not add --timeout or --workers in the shell script
2021-11-29 16:31:41 +08:00
if [ [ -n " ${ TEST_TIMEOUT :- } " ] ] ; then
2021-12-30 14:19:18 +08:00
2021-12-09 22:12:22 +08:00
timeout " ${ TEST_TIMEOUT } " pytest --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } \
2021-12-29 11:52:48 +08:00
--html= ${ CI_LOG_PATH } /report.html --self-contained-html ${ @ :- }
2021-11-29 16:31:41 +08:00
else
2021-12-09 22:12:22 +08:00
pytest --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } \
2021-12-29 11:52:48 +08:00
--html= ${ CI_LOG_PATH } /report.html --self-contained-html ${ @ :- }
2023-05-24 15:27:26 +08:00
fi
# Run bulk insert test
if [ [ -n " ${ TEST_TIMEOUT :- } " ] ] ; then
timeout " ${ TEST_TIMEOUT } " pytest testcases/test_bulk_insert.py --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } --minio_host ${ MINIO_SERVICE_NAME } \
--html= ${ CI_LOG_PATH } /report_bulk_insert.html --self-contained-html
else
pytest testcases/test_bulk_insert.py --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } --minio_host ${ MINIO_SERVICE_NAME } \
--html= ${ CI_LOG_PATH } /report_bulk_insert.html --self-contained-html
2021-11-29 16:31:41 +08:00
fi