Skip to content

Commit ce7e973

Browse files
authored
Use milvus docker container for integration test (#443)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent c0b3cd7 commit ce7e973

44 files changed

Lines changed: 751 additions & 446 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yaml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ jobs:
4545
version: 22.04
4646
image: ubuntu:22.04
4747
key: u2204
48-
- distro: Fedora
49-
version: 38
50-
image: fedora:38
51-
key: fc38
5248
- distro: Fedora
5349
version: 39
5450
image: fedora:39
@@ -81,7 +77,35 @@ jobs:
8177
- name: Unit Testing
8278
run: |
8379
make test
84-
st-ubuntu:
80+
integration-test:
81+
name: Integration test
82+
runs-on: ubuntu-22.04
83+
timeout-minutes: 75
84+
env:
85+
CCACHE_DIR: ${{ github.workspace }}/.ccache
86+
CCACHE_COMPILERCHECK: content
87+
CCACHE_COMPRESS: 1
88+
CCACHE_COMPRESSLEVEL: 5
89+
CCACHE_MAXSIZE: 2G
90+
steps:
91+
- name: Env
92+
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
93+
- name: Checkout
94+
uses: actions/checkout@v4
95+
- name: Cache ccache
96+
uses: actions/cache@v4
97+
with:
98+
path: |
99+
${{ github.workspace }}/.ccache
100+
key: ubuntu-2204-st-ccache-${{ github.sha }}
101+
restore-keys: ubuntu-2204-st-ccache-
102+
- name: Prepare
103+
run: |
104+
sh scripts/install_deps.sh
105+
- name: Integration Testing
106+
run: |
107+
make st
108+
coverage-ubuntu:
85109
name: Test all with coverage
86110
runs-on: ubuntu-${{ matrix.ubuntu }}
87111
timeout-minutes: 120
@@ -100,13 +124,14 @@ jobs:
100124
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
101125
- name: Checkout
102126
uses: actions/checkout@v4
103-
- name: Cache ccache
127+
- name: Cache ccache and conan
104128
uses: actions/cache@v4
105129
with:
106130
path: |
107131
${{ github.workspace }}/.ccache
108-
key: ubuntu-${{ matrix.ubuntu }}-ccache-${{ github.sha }}
109-
restore-keys: ubuntu-${{ matrix.ubuntu }}-ccache-
132+
~/.conan2
133+
key: ubuntu-${{ matrix.ubuntu }}-cache-${{ github.sha }}
134+
restore-keys: ubuntu-${{ matrix.ubuntu }}-cache-
110135
- uses: actions/setup-python@v4
111136
with:
112137
python-version: '3.8'
@@ -186,7 +211,7 @@ jobs:
186211
shell: cmd
187212
run: |
188213
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
189-
cmake -S . -B build -DMILVUS_BUILD_TEST=YES -G Ninja
214+
cmake -S . -B build -DMILVUS_BUILD_TEST=YES -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
190215
cmake --build build
191216
- name: Unit Testing
192217
shell: cmd

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
## milvus-sdk-cpp 2.5.2 (2025-12-04)
8787
### Feature
88-
- Introduce MilvusClientV2 for clean/expanable interfaces
88+
- Introduce MilvusClientV2 for clean/expandable interfaces
8989

9090
## milvus-sdk-cpp 2.5.1 (2025-11-21)
9191
### Feature
@@ -154,10 +154,10 @@
154154
- Support search with grouping by field
155155
- Add retry machinery for rpc call
156156
- Add CurrentUsedDatabase method for MilvusClient
157-
- Add methods for QuertResults/SearchResults to return row-based results
157+
- Add methods for QueryResults/SearchResults to return row-based results
158158

159159

160-
### Orther changes
160+
### Other changes
161161
- Remove unsupported index types(IVF_HNSW/RHNSW_FLAT/RHNSW_SQ/RHNSW_PQ/ANNOY)
162162
- Remove unsupported metric types(TANIMOTO/SUBSTRUCTURE/SUPERSTRUCTURE)
163163
- Remove CalcDistance interface, not supported by milvus 2.4

DEVELOPMENT.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ $ make
5656

5757
By default, `make` command downloads gRPC source code from github and compile it under the CMake build directory.
5858

59-
You can use a pre-built gRPC lib build by youself. milvus-sdk-cpp 2.4 is using gRPC v1.59.0, make sure your gRPC version is compatible.
59+
You can use a pre-built gRPC lib build by yourself. milvus-sdk-cpp 2.4 is using gRPC v1.59.0, make sure your gRPC version is compatible.
6060

6161
### Download gRPC source code
6262
```shell
@@ -80,7 +80,7 @@ $ cmake -DCMAKE_INSTALL_PREFIX=/path/to/pre-installed/grpc -DBUILD_SHARED_LIBS=
8080
$ make
8181
$ make install
8282
```
83-
Make sure the `BUILD_SHARED_LIBS` is `ON` since milvus-sdk-cpp dynamiclly links to gRPC.
83+
Make sure the `BUILD_SHARED_LIBS` is `ON` since milvus-sdk-cpp dynamically links to gRPC.
8484

8585
### Use `GRPC_PATH` to specify the external gRPC and build milvus-sdk-cpp
8686
```shell
@@ -113,7 +113,7 @@ to automatic format all c++ source code
113113
## Run tests, and add testing code
114114
Milvus C++ SDK using googletest as a test framework. You could run `make test` to run unit testing and integration testing.
115115

116-
If you have an pre-installed gRPC, use `GRPC_PATH` to specify the path:
116+
If you have a pre-installed gRPC, use `GRPC_PATH` to specify the path:
117117
```shell
118118
$ make test GRPC_PATH=/path/to/pre-installed/grpc
119119
```
@@ -132,8 +132,8 @@ $ ./cmake_build/test/testing-st
132132
```
133133

134134
### Run acceptance/system tests with real Milvus server
135-
The acceptance/system tests are not included by default. You cloud using the below commands to run them:
136-
- `make st` user the top source directory
135+
The acceptance/system tests are not included by default. You could use the below commands to run them:
136+
- `make st` under the top source directory
137137
- `make system-test` under the CMake build directory
138138

139139
The acceptance/system tests will startup container by docker, and using jq to capture the output from docker inspect,
@@ -154,7 +154,7 @@ After the command, a folder named "code_coverage" will be created under the proj
154154
You could open the **code_coverage/index.html** by a web browser to review the code coverage report.
155155

156156
## Generate documentation
157-
Milvus C++ SDK using **doxygen** tool to generate documentation. Run `make documentation` to generate documentation.
157+
Milvus C++ SDK uses **doxygen** tool to generate documentation. Run `make documentation` to generate documentation.
158158
Typically, we only publish documentation before releasing a new sdk version.
159159
Since the **doxygen** is not included in the `install_deps.sh`, you need to manually install it if you want to generate the documentation by yourself.
160160

@@ -165,7 +165,7 @@ Since the **doxygen** is not included in the `install_deps.sh`, you need to manu
165165
The setup steps and development environment for macOS are similar to Linux.
166166
You could use `install_deps.sh` to install dependencies and use the same `make` commands for build, lint, test, and coverage.
167167

168-
### Prerequests
168+
### Prerequisites
169169
Before you run `install_deps.sh` to install dependencies, you should make sure:
170-
- Already installed (Homebrew)[https://brew.sh/]
171-
- Install Command line tools for Xcode, by command: `xcode-select --instal`
170+
- Already installed [Homebrew](https://brew.sh/)
171+
- Install Command line tools for Xcode, by command: `xcode-select --install`

examples/example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Examples for MilvusClientV2:
4747
- `./cmake_build/examples/v2/sdk_nullable_field_v2`: example to show the usage of nullable field.
4848
- `./cmake_build/examples/v2/sdk_partition_key_v2`: example to show the usage of partition key.
4949
- `./cmake_build/examples/v2/sdk_rbac_v2`: example to show the usage of RBAC.
50-
- `./cmake_build/examples/v2/sdk_rerank_function_v2`: example to show the usage of rarank function.
50+
- `./cmake_build/examples/v2/sdk_rerank_function_v2`: example to show the usage of rerank function.
5151
- `./cmake_build/examples/v2/sdk_run_analyzer_v2`: example to show the usage of run_analyzer().
5252
- `./cmake_build/examples/v2/sdk_simple_v2`: example to quickly create a simple collection.
5353
- `./cmake_build/examples/v2/sdk_struct_field_v2`: example to show the usage of struct field.

scripts/build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ if [[ "${BUILD_FROM_CONAN}" == "ON" ]]; then
138138

139139
# Build folder layout follows Conan 2 CMakeToolchain defaults:
140140
# cmake_build/build/<BuildType>/generators/conan_toolchain.cmake
141+
# Workaround: CMake 4.x removed compat with cmake_minimum_required < 3.5,
142+
# which breaks older Conan recipes (e.g. c-ares/1.19.1).
143+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
144+
141145
${CONAN} install .. \
142146
-of . \
143147
-s build_type=${BUILD_TYPE} \
@@ -237,13 +241,15 @@ fi
237241

238242
if [[ "${UNIT_TEST}" == "ON" ]]; then
239243
make -j ${JOBS} || exit 1
240-
./test/testing-ut || exit 1
241-
./test/testing-it || exit 1
244+
# Suppress gRPC verbose logs during tests
245+
GRPC_VERBOSITY=ERROR ./test/testing-ut || exit 1
246+
GRPC_VERBOSITY=ERROR ./test/testing-it || exit 1
242247
fi
243248

244249
if [[ "${SYS_TEST}" == "ON" ]]; then
245250
make -j ${JOBS} || exit 1
246-
./test/testing-st || exit 1
251+
# Suppress gRPC verbose logs during tests
252+
GRPC_VERBOSITY=ERROR ./test/testing-st || exit 1
247253
fi
248254

249255
if [[ "${DO_INSTALL}" == "ON" ]]; then

scripts/install_deps.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ install_deps_for_ubuntu_common() {
9696
libssl-dev iwyu lcov git python3-pip clang-format clang-tidy
9797
install_linux_cmake_clang_toolchain
9898
install_conan
99+
100+
echo 'Pip install docker for integration tests.'
101+
pip3 install --user "docker>=7.0.0"
99102
}
100103

101104
install_deps_for_ubuntu_1804() {
@@ -115,6 +118,9 @@ install_deps_for_fedora_common() {
115118
${SUDO} dnf -y install gcc gcc-c++ python2 gpg wget ccache make openssl-devel which lcov git rpm-build python3-pip perl perl-core
116119
install_linux_cmake_clang_toolchain
117120
install_conan
121+
122+
echo 'Pip install docker for integration tests.'
123+
pip3 install --user "docker>=7.0.0"
118124
}
119125

120126
install_deps_for_centos_8() {

scripts/run_clang_tidy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import lintutils
2323
from subprocess import PIPE
2424
import sys
25+
import time
2526
from functools import partial
2627

2728

@@ -113,6 +114,10 @@ def _check_all(cmd, filenames):
113114
'-p',
114115
arguments.compile_commands
115116
]
117+
118+
print("clang-tidy: {} files to check".format(len(linted_filenames)))
119+
start_time = time.time()
120+
116121
if arguments.fix:
117122
cmd.append('-fix')
118123
results = lintutils.run_parallel(
@@ -123,3 +128,6 @@ def _check_all(cmd, filenames):
123128

124129
else:
125130
_check_all(cmd, linted_filenames)
131+
132+
elapsed = time.time() - start_time
133+
print("clang-tidy: finished in {:.1f} seconds".format(elapsed))

src/impl/MilvusClientV2Impl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Status
112112
MilvusClientV2Impl::CreateCollection(const CreateCollectionRequest& request) {
113113
const auto& schemaPtr = request.CollectionSchema();
114114
if (schemaPtr == nullptr) {
115-
return {StatusCode::INVALID_AGUMENT, "Collection schema is null"};
115+
return {StatusCode::INVALID_ARGUMENT, "Collection schema is null"};
116116
}
117117

118118
CollectionSchema& schema = *schemaPtr;
@@ -188,7 +188,7 @@ MilvusClientV2Impl::CreateCollection(const CreateSimpleCollectionRequest& reques
188188
if (request.PrimaryFieldType() == DataType::VARCHAR) {
189189
pk_field.SetMaxLength(static_cast<uint32_t>(request.MaxLength()));
190190
} else if (request.PrimaryFieldType() != DataType::INT64) {
191-
return {StatusCode::INVALID_AGUMENT, "Primary field type is illegal"};
191+
return {StatusCode::INVALID_ARGUMENT, "Primary field type is illegal"};
192192
}
193193

194194
milvus::FieldSchema vector_field = milvus::FieldSchema(request.VectorFieldName(), DataType::FLOAT_VECTOR);
@@ -1062,7 +1062,7 @@ MilvusClientV2Impl::Insert(const InsertRequest& request, InsertResponse& respons
10621062
const auto& fields = request.ColumnsData();
10631063
const auto& rows = request.RowsData();
10641064
if (!fields.empty() && !rows.empty()) {
1065-
return Status{StatusCode::INVALID_AGUMENT, "Not allow to set ColumnsData and RowsData both"};
1065+
return Status{StatusCode::INVALID_ARGUMENT, "Not allow to set ColumnsData and RowsData both"};
10661066
}
10671067

10681068
if (!rows.empty()) {
@@ -1161,7 +1161,7 @@ MilvusClientV2Impl::Upsert(const UpsertRequest& request, UpsertResponse& respons
11611161
const auto& fields = request.ColumnsData();
11621162
const auto& rows = request.RowsData();
11631163
if (!fields.empty() && !rows.empty()) {
1164-
return Status{StatusCode::INVALID_AGUMENT, "Not allow to set ColumnsData and RowsData both"};
1164+
return Status{StatusCode::INVALID_ARGUMENT, "Not allow to set ColumnsData and RowsData both"};
11651165
}
11661166

11671167
if (!rows.empty()) {
@@ -1255,12 +1255,12 @@ MilvusClientV2Impl::Delete(const DeleteRequest& request, DeleteResponse& respons
12551255
rpc_request.set_partition_name(request.PartitionName());
12561256

12571257
if (request.Filter().empty() && request.IDs().GetRowCount() == 0) {
1258-
return Status{StatusCode::INVALID_AGUMENT,
1258+
return Status{StatusCode::INVALID_ARGUMENT,
12591259
"Deletion condition must be specified, by primary keys or by filter expression"};
12601260
}
12611261

12621262
if (!request.Filter().empty() && request.IDs().GetRowCount() != 0) {
1263-
return Status{StatusCode::INVALID_AGUMENT,
1263+
return Status{StatusCode::INVALID_ARGUMENT,
12641264
"Ambiguous filter parameter, only one deletion condition can be specified"};
12651265
}
12661266

src/impl/MilvusConnection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ MilvusConnection::Connect(const ConnectParam& param) {
158158
ss << std::put_time(local_time, "%Y-%m-%d %H:%M:%S");
159159
client_info->set_local_time(ss.str());
160160

161-
// the defalut value of ConnectTimeout is 10 seconds, means if the server could not return response
161+
// the default value of ConnectTimeout is 10 seconds, means if the server could not return response
162162
// in 10 seconds, the MilvusClient will return an error
163163
::grpc::ClientContext context;
164164
if (param.ConnectTimeout() > 0) {

src/impl/types/EmbeddingList.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ template <typename T, typename V>
218218
Status
219219
EmbeddingList::addVector(DataType data_type, const V& vector) {
220220
if (target_vectors_ != nullptr && target_vectors_->Type() != data_type) {
221-
return {StatusCode::INVALID_AGUMENT, "Target vector must be the same type!"};
221+
return {StatusCode::INVALID_ARGUMENT, "Target vector must be the same type!"};
222222
}
223223

224224
StatusCode code = StatusCode::OK;
@@ -233,7 +233,7 @@ EmbeddingList::addVector(DataType data_type, const V& vector) {
233233
if (data_type != DataType::VARCHAR && data_type != DataType::SPARSE_FLOAT_VECTOR && dim_ != dim) {
234234
std::string msg =
235235
"Vector size mismatch, first: " + std::to_string(dim_) + ", current: " + std::to_string(dim);
236-
return {StatusCode::INVALID_AGUMENT, msg};
236+
return {StatusCode::INVALID_ARGUMENT, msg};
237237
}
238238

239239
std::shared_ptr<T> vectors = std::static_pointer_cast<T>(target_vectors_);
@@ -251,7 +251,7 @@ template <typename T, typename V>
251251
Status
252252
EmbeddingList::setVectors(DataType data_type, std::vector<V>&& vectors) {
253253
if (vectors.empty()) {
254-
return {StatusCode::INVALID_AGUMENT, "Vector list is empty"};
254+
return {StatusCode::INVALID_ARGUMENT, "Vector list is empty"};
255255
}
256256

257257
// this method will reset the vector list
@@ -266,7 +266,7 @@ EmbeddingList::setVectors(DataType data_type, std::vector<V>&& vectors) {
266266
if (data_type != DataType::VARCHAR && data_type != DataType::SPARSE_FLOAT_VECTOR && dim_ != dim) {
267267
std::string msg =
268268
"Vector size mismatch, first: " + std::to_string(dim_) + ", current: " + std::to_string(dim);
269-
status = {StatusCode::INVALID_AGUMENT, msg};
269+
status = {StatusCode::INVALID_ARGUMENT, msg};
270270
}
271271
}
272272
target_vectors_ = std::make_shared<T>("", std::move(vectors));

0 commit comments

Comments
 (0)