From 13d7b1971a7e2b12f88491f7a1b96fd188d374f4 Mon Sep 17 00:00:00 2001 From: zhenwu Date: Wed, 23 Oct 2019 09:53:33 +0800 Subject: [PATCH 1/6] Update test nq size Former-commit-id: 933de17077aa4027a827f01f30278cab6e8b8434 --- tests/milvus_python_test/test_index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/milvus_python_test/test_index.py b/tests/milvus_python_test/test_index.py index 435a547855..9e9f0830ac 100644 --- a/tests/milvus_python_test/test_index.py +++ b/tests/milvus_python_test/test_index.py @@ -11,7 +11,7 @@ import numpy from milvus import Milvus, IndexType, MetricType from utils import * -nb = 100000 +nb = 10000 dim = 128 index_file_size = 10 vectors = gen_vectors(nb, dim) From dead8ee68867935e2eb8f7357ad7a6e0911143e3 Mon Sep 17 00:00:00 2001 From: zhenwu Date: Wed, 23 Oct 2019 14:33:01 +0800 Subject: [PATCH 2/6] add exit code in coverage.sh Former-commit-id: 27a834232561cbda1360cd245f73d89db5d48750 --- core/coverage.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/coverage.sh b/core/coverage.sh index 74f9f4219d..b3c2e96eed 100755 --- a/core/coverage.sh +++ b/core/coverage.sh @@ -99,6 +99,7 @@ for test in `ls ${DIR_UNITTEST}`; do if [ $? -ne 0 ]; then echo ${args} echo ${DIR_UNITTEST}/${test} "run failed" + exit -1 fi done @@ -123,6 +124,10 @@ ${LCOV_CMD} -r "${FILE_INFO_OUTPUT}" -o "${FILE_INFO_OUTPUT_NEW}" \ "*/src/server/grpc_impl/GrpcServer.cpp" \ "*/src/utils/easylogging++.h" \ "*/src/utils/easylogging++.cc" +if [ $? -ne 0 ]; then + echo "generate ${FILE_INFO_OUTPUT_NEW} failed" + exit -2 +fi # gen html report ${LCOV_GEN_CMD} "${FILE_INFO_OUTPUT_NEW}" --output-directory ${DIR_LCOV_OUTPUT}/ From 07cc917c5612e18173c6d6dce7de34054394e2d2 Mon Sep 17 00:00:00 2001 From: zhenwu Date: Wed, 23 Oct 2019 14:52:12 +0800 Subject: [PATCH 3/6] update coverage timeout && add coverage exit code Former-commit-id: 0c623d2348e73dc0c1df24f96098c4c5568e73ba --- ci/jenkins/jenkinsfile/coverage.groovy | 2 +- ci/jenkins/scripts/coverage.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/jenkins/jenkinsfile/coverage.groovy b/ci/jenkins/jenkinsfile/coverage.groovy index 7c3b16c029..ff2e3e6fa2 100644 --- a/ci/jenkins/jenkinsfile/coverage.groovy +++ b/ci/jenkins/jenkinsfile/coverage.groovy @@ -1,4 +1,4 @@ -timeout(time: 60, unit: 'MINUTES') { +timeout(time: 30, unit: 'MINUTES') { dir ("ci/jenkins/scripts") { sh "./coverage.sh -o /opt/milvus -u root -p 123456 -t \$POD_IP" // Set some env variables so codecov detection script works correctly diff --git a/ci/jenkins/scripts/coverage.sh b/ci/jenkins/scripts/coverage.sh index ecbb2dfbe9..dd52df442c 100755 --- a/ci/jenkins/scripts/coverage.sh +++ b/ci/jenkins/scripts/coverage.sh @@ -109,6 +109,7 @@ for test in `ls ${DIR_UNITTEST}`; do if [ $? -ne 0 ]; then echo ${args} echo ${DIR_UNITTEST}/${test} "run failed" + exit -1 fi done @@ -134,5 +135,10 @@ ${LCOV_CMD} -r "${FILE_INFO_OUTPUT}" -o "${FILE_INFO_OUTPUT_NEW}" \ "*/src/utils/easylogging++.h" \ "*/src/utils/easylogging++.cc" +if [ $? -ne 0 ]; then + echo "gen ${FILE_INFO_OUTPUT_NEW} failed" + exit -2 +fi + # gen html report # ${LCOV_GEN_CMD} "${FILE_INFO_OUTPUT_NEW}" --output-directory ${DIR_LCOV_OUTPUT}/ From f410219fc29c54cf1dcb19f193ab91cea299f6f2 Mon Sep 17 00:00:00 2001 From: zhenwu Date: Wed, 23 Oct 2019 16:43:08 +0800 Subject: [PATCH 4/6] update utils.py Former-commit-id: 837591d04e95503c6e66f3960866949f628224e4 --- tests/milvus_python_test/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/milvus_python_test/utils.py b/tests/milvus_python_test/utils.py index 806af62f57..007bff9c75 100644 --- a/tests/milvus_python_test/utils.py +++ b/tests/milvus_python_test/utils.py @@ -475,7 +475,7 @@ if __name__ == "__main__": table = "test" - file_name = '/poc/yuncong/ann_1000m/query.npy' + file_name = 'query.npy' data = np.load(file_name) vectors = data[0:nq].tolist() # print(vectors) From 581c662b61c99a94f4969c9b56c7fc1c0e3654f2 Mon Sep 17 00:00:00 2001 From: zhenwu Date: Thu, 24 Oct 2019 00:52:33 +0800 Subject: [PATCH 5/6] remove sq8h Former-commit-id: 31deed25ae121396fe8352efad36609452ac6c01 --- tests/milvus_python_test/test_add_vectors.py | 8 ++++---- tests/milvus_python_test/test_index.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/milvus_python_test/test_add_vectors.py b/tests/milvus_python_test/test_add_vectors.py index 51c12dcd87..e223eaa5f6 100644 --- a/tests/milvus_python_test/test_add_vectors.py +++ b/tests/milvus_python_test/test_add_vectors.py @@ -573,7 +573,7 @@ class TestAddBase: nq = 100 vectors = gen_vectors(nq, dim) table_list = [] - for i in range(50): + for i in range(20): table_name = gen_unique_str('test_add_vector_multi_tables') table_list.append(table_name) param = {'table_name': table_name, @@ -581,9 +581,9 @@ class TestAddBase: 'index_file_size': index_file_size, 'metric_type': MetricType.L2} connect.create_table(param) - time.sleep(2) - for j in range(10): - for i in range(50): + time.sleep(5) + for j in range(5): + for i in range(20): status, ids = connect.add_vectors(table_name=table_list[i], records=vectors) assert status.OK() diff --git a/tests/milvus_python_test/test_index.py b/tests/milvus_python_test/test_index.py index 9e9f0830ac..76774c0cf9 100644 --- a/tests/milvus_python_test/test_index.py +++ b/tests/milvus_python_test/test_index.py @@ -37,7 +37,10 @@ class TestIndexBase: params=gen_simple_index_params() ) def get_simple_index_params(self, request): - yield request.param + if "internal" not in args: + if request.param["index_type"] == IndexType.IVF_SQ8H: + pytest.skip("sq8h not support in open source") + return request.param """ ****************************************************************** @@ -515,7 +518,10 @@ class TestIndexIP: params=gen_simple_index_params() ) def get_simple_index_params(self, request): - yield request.param + if "internal" not in args: + if request.param["index_type"] == IndexType.IVF_SQ8H: + pytest.skip("sq8h not support in open source") + return request.param """ ****************************************************************** From c01107e2c7cb40d65ea49e2527ecafc5f99f0695 Mon Sep 17 00:00:00 2001 From: zhenwu Date: Thu, 24 Oct 2019 01:00:20 +0800 Subject: [PATCH 6/6] re-define case level Former-commit-id: 6c2ae8329c1ea9e22f0cba75d6603987a874b8c8 --- tests/milvus_python_test/test_add_vectors.py | 4 +++- tests/milvus_python_test/test_index.py | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/milvus_python_test/test_add_vectors.py b/tests/milvus_python_test/test_add_vectors.py index e223eaa5f6..e33328625a 100644 --- a/tests/milvus_python_test/test_add_vectors.py +++ b/tests/milvus_python_test/test_add_vectors.py @@ -407,6 +407,7 @@ class TestAddBase: def get_vector_id(self, request): yield request.param + @pytest.mark.level(2) def test_add_vectors_ids_invalid(self, connect, table, get_vector_id): ''' target: test add vectors in table, use customize ids, which are not int64 @@ -974,6 +975,7 @@ class TestAddIP: def get_vector_id(self, request): yield request.param + @pytest.mark.level(2) def test_add_vectors_ids_invalid(self, connect, ip_table, get_vector_id): ''' target: test add vectors in table, use customize ids, which are not int64 @@ -1223,7 +1225,7 @@ class TestAddTableVectorsInvalid(object): with pytest.raises(Exception) as e: status, result = connect.add_vectors(table, tmp_single_vector) - @pytest.mark.level(1) + @pytest.mark.level(2) def test_add_vectors_with_invalid_vectors(self, connect, table, gen_vector): tmp_vectors = copy.deepcopy(self.vectors) tmp_vectors[1][1] = gen_vector diff --git a/tests/milvus_python_test/test_index.py b/tests/milvus_python_test/test_index.py index 76774c0cf9..e4c8848d63 100644 --- a/tests/milvus_python_test/test_index.py +++ b/tests/milvus_python_test/test_index.py @@ -528,7 +528,7 @@ class TestIndexIP: The following cases are used to test `create_index` function ****************************************************************** """ - + @pytest.mark.level(2) @pytest.mark.timeout(BUILD_TIMEOUT) def test_create_index(self, connect, ip_table, get_index_params): ''' @@ -563,6 +563,7 @@ class TestIndexIP: logging.getLogger().info(index_params) status, ids = connect.add_vectors(ip_table, vectors) status = connect.create_index(ip_table, index_params) + assert status.OK() logging.getLogger().info(connect.describe_index(ip_table)) query_vecs = [vectors[0], vectors[1], vectors[2]] top_k = 5 @@ -933,19 +934,19 @@ class TestIndexTableInvalid(object): def get_table_name(self, request): yield request.param - # @pytest.mark.level(1) + @pytest.mark.level(2) def test_create_index_with_invalid_tablename(self, connect, get_table_name): table_name = get_table_name status = connect.create_index(table_name, random.choice(gen_index_params())) assert not status.OK() - # @pytest.mark.level(1) + @pytest.mark.level(2) def test_describe_index_with_invalid_tablename(self, connect, get_table_name): table_name = get_table_name status, result = connect.describe_index(table_name) assert not status.OK() - # @pytest.mark.level(1) + @pytest.mark.level(2) def test_drop_index_with_invalid_tablename(self, connect, get_table_name): table_name = get_table_name status = connect.drop_index(table_name)