Skip to content

Commit

Permalink
Merge collection test cases from pymilvus and orm (milvus-io#7414)
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin Lv <binbin.lv@zilliz.com>
  • Loading branch information
binbinlv authored Sep 1, 2021
1 parent bd3056f commit 068cc14
Show file tree
Hide file tree
Showing 29 changed files with 3,319 additions and 3,972 deletions.
2 changes: 1 addition & 1 deletion build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ To run E2E tests, use these command:
```shell
MILVUS_SERVICE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker-compose ps -q builder))
cd tests/docker
docker-compose run --rm pytest /bin/bash -c "pytest --ip ${MILVUS_SERVICE_IP}"
docker-compose run --rm pytest /bin/bash -c "pytest --host ${MILVUS_SERVICE_IP}"
```


Expand Down
2 changes: 1 addition & 1 deletion build/ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pipeline {
--install-extra-arg "--set etcd.enabled=false --set externalEtcd.enabled=true --set externalEtcd.endpoints={\$KRTE_POD_IP:2379}" \
--skip-export-logs \
--skip-cleanup \
--test-extra-arg "-x --tags smoke L0 L1" \
--test-extra-arg "-x --tags L0 L1" \
--test-timeout ${e2e_timeout_seconds}
"""
// } else if ("${MILVUS_CLIENT}" == "pymilvus-orm") {
Expand Down
2 changes: 1 addition & 1 deletion build/ci/jenkins/NightlyCI.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pipeline {
--install-extra-arg "--set etcd.enabled=false --set externalEtcd.enabled=true --set externalEtcd.endpoints={\$KRTE_POD_IP:2379}" \
--skip-export-logs \
--skip-cleanup \
--test-extra-arg "--tags smoke L0 L1 L2" \
--test-extra-arg "--tags L0 L1 L2" \
--test-timeout ${e2e_timeout_seconds}
"""
// } else if ("${MILVUS_CLIENT}" == "pymilvus-orm") {
Expand Down
39 changes: 16 additions & 23 deletions tests/python_client/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


def pytest_addoption(parser):
parser.addoption("--ip", action="store", default="localhost", help="service's ip")
parser.addoption("--host", action="store", default="localhost", help="service's ip")
parser.addoption("--service", action="store", default="", help="service address")
parser.addoption("--port", action="store", default=19530, help="service's port")
Expand All @@ -39,14 +38,8 @@ def pytest_addoption(parser):
parser.addoption('--term_expr', action='store', default="term_expr", help="expr of query quest")
parser.addoption('--check_content', action='store', default="check_content", help="content of check")
parser.addoption('--field_name', action='store', default="field_name", help="field_name of index")
parser.addoption('--dry-run', action='store_true', default=False)
parser.addoption("--http-port", action="store", default=19121)


@pytest.fixture
def ip(request):
return request.config.getoption("--ip")


@pytest.fixture
def host(request):
Expand Down Expand Up @@ -233,7 +226,7 @@ def pytest_runtest_setup(item):


def pytest_runtestloop(session):
if session.config.getoption('--dry-run'):
if session.config.getoption('--dry_run'):
total_num = 0
file_num = 0
tags_num = 0
Expand All @@ -254,13 +247,13 @@ def pytest_runtestloop(session):


def check_server_connection(request):
ip = request.config.getoption("--ip")
host = request.config.getoption("--host")
port = request.config.getoption("--port")

connected = True
if ip and (ip not in ['localhost', '127.0.0.1']):
if host and (host not in ['localhost', '127.0.0.1']):
try:
socket.getaddrinfo(ip, port, 0, 0, socket.IPPROTO_TCP)
socket.getaddrinfo(host, port, 0, 0, socket.IPPROTO_TCP)
except Exception as e:
print("Socket connnet failed: %s" % str(e))
connected = False
Expand Down Expand Up @@ -297,15 +290,15 @@ def check_server_connection(request):

@pytest.fixture(scope="module")
def connect(request):
ip = request.config.getoption("--ip")
host = request.config.getoption("--host")
service_name = request.config.getoption("--service")
port = request.config.getoption("--port")
http_port = request.config.getoption("--http-port")
http_port = request.config.getoption("--http_port")
handler = request.config.getoption("--handler")
if handler == "HTTP":
port = http_port
try:
milvus = get_milvus(host=ip, port=port, handler=handler)
milvus = get_milvus(host=host, port=port, handler=handler)
# reset_build_index_threshold(milvus)
except Exception as e:
logging.getLogger().error(str(e))
Expand All @@ -322,40 +315,40 @@ def fin():

@pytest.fixture(scope="module")
def dis_connect(request):
ip = request.config.getoption("--ip")
host = request.config.getoption("--host")
service_name = request.config.getoption("--service")
port = request.config.getoption("--port")
http_port = request.config.getoption("--http-port")
http_port = request.config.getoption("--http_port")
handler = request.config.getoption("--handler")
if handler == "HTTP":
port = http_port
milvus = get_milvus(host=ip, port=port, handler=handler)
milvus = get_milvus(host=host, port=port, handler=handler)
milvus.close()
return milvus


@pytest.fixture(scope="module")
def args(request):
ip = request.config.getoption("--ip")
host = request.config.getoption("--host")
service_name = request.config.getoption("--service")
port = request.config.getoption("--port")
http_port = request.config.getoption("--http-port")
http_port = request.config.getoption("--http_port")
handler = request.config.getoption("--handler")
if handler == "HTTP":
port = http_port
args = {"ip": ip, "port": port, "handler": handler, "service_name": service_name}
args = {"ip": host, "port": port, "handler": handler, "service_name": service_name}
return args


@pytest.fixture(scope="module")
def milvus(request):
ip = request.config.getoption("--ip")
host = request.config.getoption("--host")
port = request.config.getoption("--port")
http_port = request.config.getoption("--http-port")
http_port = request.config.getoption("--http_port")
handler = request.config.getoption("--handler")
if handler == "HTTP":
port = http_port
return get_milvus(host=ip, port=port, handler=handler)
return get_milvus(host=host, port=port, handler=handler)


@pytest.fixture(scope="function")
Expand Down
2 changes: 1 addition & 1 deletion tests/python_client/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[pytest]


addopts = --ip localhost --host localhost --html=/tmp/ci_logs/report.html --self-contained-html -v
addopts = --host localhost --html=/tmp/ci_logs/report.html --self-contained-html -v
# -;addopts = --host 172.28.255.155 --html=/tmp/report.html
# python3 -W ignore -m pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/python_client/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pytest-print==0.2.1
pytest-level==0.1.1
pytest-xdist==2.2.1
# pytest-parallel
pymilvus==2.0.0rc5.dev29
pymilvus==2.0.0rc6.dev3
pytest-rerunfailures==9.1.1
git+https://github.com/Projectplace/pytest-tags
ndg-httpsclient
Expand Down
Loading

0 comments on commit 068cc14

Please sign in to comment.