2021-11-24 08:13:15 +00:00
#!/bin/bash
2022-01-07 01:53:22 +00: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 05:30:38 +00:00
# with the License. You may obtain a copy of the License at
2021-11-24 08:13:15 +00:00
#
2022-01-07 01:53:22 +00:00
# http://www.apache.org/licenses/LICENSE-2.0
2021-11-24 08:13:15 +00:00
#
2022-01-07 01:53:22 +00: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 08:13:15 +00: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 06:20:23 +00:00
# Exit immediately for non zero status
2021-11-24 08:13:15 +00:00
set -e
2021-12-02 05:01:37 +00:00
# Check unset variables
2021-11-24 08:13:15 +00:00
set -u
2021-12-03 05:24:18 +00:00
# Print commands
2021-11-24 08:13:15 +00: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 06:19:18 +00:00
# Use service name instead of IP to test
2021-12-31 06:14:17 +00:00
MILVUS_SERVICE_NAME = $( echo " ${ MILVUS_HELM_RELEASE_NAME } -milvus. ${ MILVUS_HELM_NAMESPACE } " | tr -d '\n' )
2021-11-24 08:13:15 +00:00
MILVUS_SERVICE_PORT = "19530"
2023-05-24 07:27:26 +00:00
# Minio service name
MINIO_SERVICE_NAME = $( echo " ${ MILVUS_HELM_RELEASE_NAME } -minio. ${ MILVUS_HELM_NAMESPACE } " | tr -d '\n' )
2021-11-24 08:13:15 +00:00
2021-12-30 06:19:18 +00:00
# Shellcheck source=ci-util.sh
2021-11-24 08:13:15 +00:00
source " ${ ROOT } /tests/scripts/ci-util.sh "
cd ${ ROOT } /tests/python_client
2021-12-01 02:41:34 +00:00
2021-12-30 06:19:18 +00:00
# Print python3 version, python version 3.6.8 is more stable for test
2021-11-24 08:13:15 +00:00
python3 -V
2021-12-07 01:39:54 +00:00
2021-12-30 06:19:18 +00:00
# Pytest will try to get ${CI_LOG_PATH} from environment variables first,then use default path
2021-12-01 07:49:31 +00:00
export CI_LOG_PATH = /tmp/ci_logs/test
2021-12-01 02:41:34 +00:00
2021-11-24 08:13:15 +00:00
if [ ! -d " ${ CI_LOG_PATH } " ] ; then
2021-12-30 06:19:18 +00:00
# Create dir for ci log path when it does not exist
2021-12-13 05:20:03 +00:00
mkdir -p ${ CI_LOG_PATH }
2021-11-24 08:13:15 +00:00
fi
2022-01-05 01:41:32 +00:00
2024-08-27 06:24:59 +00:00
# skip pip install when DISABLE_PIP_INSTALL is set
if [ " ${ DISABLE_PIP_INSTALL :- } " = "" ] ; then
echo "prepare e2e test"
install_pytest_requirements
fi
2021-11-24 08:13:15 +00:00
2024-05-31 05:54:07 +00:00
if [ [ " ${ MILVUS_HELM_RELEASE_NAME } " != *"msop" * ] ] ; then
if [ [ -n " ${ TEST_TIMEOUT :- } " ] ] ; then
timeout " ${ TEST_TIMEOUT } " pytest testcases/test_bulk_insert.py --timeout= 300 --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 --timeout= 300 --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } --minio_host ${ MINIO_SERVICE_NAME } \
--html= ${ CI_LOG_PATH } /report_bulk_insert.html --self-contained-html
fi
fi
2021-12-29 03:52:48 +00:00
2022-01-04 11:09:37 +00:00
# Pytest is not able to have both --timeout & --workers, so do not add --timeout or --workers in the shell script
2021-11-29 08:31:41 +00:00
if [ [ -n " ${ TEST_TIMEOUT :- } " ] ] ; then
2021-12-30 06:19:18 +00:00
2021-12-09 14:12:22 +00:00
timeout " ${ TEST_TIMEOUT } " pytest --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } \
2021-12-29 03:52:48 +00:00
--html= ${ CI_LOG_PATH } /report.html --self-contained-html ${ @ :- }
2021-11-29 08:31:41 +00:00
else
2021-12-09 14:12:22 +00:00
pytest --host ${ MILVUS_SERVICE_NAME } --port ${ MILVUS_SERVICE_PORT } \
2021-12-29 03:52:48 +00:00
--html= ${ CI_LOG_PATH } /report.html --self-contained-html ${ @ :- }
2023-05-24 07:27:26 +00:00
fi