Skip to content

Commit c46e647

Browse files
committed
Use milvus docker container for integration test
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent c0b3cd7 commit c46e647

24 files changed

Lines changed: 602 additions & 295 deletions

.github/workflows/main.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,35 @@ jobs:
8181
- name: Unit Testing
8282
run: |
8383
make test
84-
st-ubuntu:
84+
integration-test:
85+
name: Integration test
86+
runs-on: ubuntu-22.04
87+
timeout-minutes: 75
88+
env:
89+
CCACHE_DIR: ${{ github.workspace }}/.ccache
90+
CCACHE_COMPILERCHECK: content
91+
CCACHE_COMPRESS: 1
92+
CCACHE_COMPRESSLEVEL: 5
93+
CCACHE_MAXSIZE: 2G
94+
steps:
95+
- name: Env
96+
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
97+
- name: Checkout
98+
uses: actions/checkout@v4
99+
- name: Cache ccache
100+
uses: actions/cache@v4
101+
with:
102+
path: |
103+
${{ github.workspace }}/.ccache
104+
key: ubuntu-2204-st-ccache-${{ github.sha }}
105+
restore-keys: ubuntu-2204-st-ccache-
106+
- name: Prepare
107+
run: |
108+
sh scripts/install_deps.sh
109+
- name: Integration Testing
110+
run: |
111+
make st
112+
coverage-ubuntu:
85113
name: Test all with coverage
86114
runs-on: ubuntu-${{ matrix.ubuntu }}
87115
timeout-minutes: 120

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))

test/it/v1/TestCreateResourceGroup.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@ TEST_F(MilvusMockedTest, CreateResourceGroup) {
4646
const auto& transfer_from = config.TransferFromGroups();
4747
const auto& rpc_from = rpc_config.transfer_from();
4848
EXPECT_EQ(rpc_from.size(), transfer_from.size());
49-
for (auto i = 0; i < rpc_from.size(); i++) {
50-
EXPECT_TRUE(transfer_from.find(rpc_from.at(i).resource_group()) != transfer_from.end());
49+
for (const auto& item : rpc_from) {
50+
EXPECT_TRUE(transfer_from.find(item.resource_group()) != transfer_from.end());
5151
}
5252

5353
const auto& transfer_to = config.TransferToGroups();
5454
const auto& rpc_to = rpc_config.transfer_to();
5555
EXPECT_EQ(rpc_to.size(), transfer_to.size());
56-
for (auto i = 0; i < rpc_to.size(); i++) {
57-
EXPECT_TRUE(transfer_to.find(rpc_to.at(i).resource_group()) != transfer_to.end());
56+
for (const auto& item : rpc_to) {
57+
EXPECT_TRUE(transfer_to.find(item.resource_group()) != transfer_to.end());
5858
}
5959

6060
const auto& node_filters = config.NodeFilters();
6161
const auto& rpc_filters = rpc_config.node_filter().node_labels();
6262
EXPECT_EQ(rpc_filters.size(), node_filters.size());
63-
for (auto i = 0; i < rpc_filters.size(); i++) {
64-
EXPECT_TRUE(node_filters.find(rpc_filters.at(i).key()) != node_filters.end());
65-
EXPECT_EQ(rpc_filters.at(i).value(), node_filters.at(rpc_filters.at(i).key()));
63+
for (const auto& rpc_filter : rpc_filters) {
64+
EXPECT_TRUE(node_filters.find(rpc_filter.key()) != node_filters.end());
65+
EXPECT_EQ(rpc_filter.value(), node_filters.at(rpc_filter.key()));
6666
}
6767

6868
return ::grpc::Status{};

test/it/v1/TestGetFlushState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ TEST_F(MilvusMockedTest, GetFlushState) {
8989

9090
// first round set c1 to flushed, c2 to unflushed, progress is 2/5
9191
// second round set c2 to flushed, progress is 5/5
92-
std::vector<milvus::Progress> progresses_expected{{(uint32_t)c1_ids.size(), segment_count},
92+
std::vector<milvus::Progress> progresses_expected{{static_cast<uint32_t>(c1_ids.size()), segment_count},
9393
{segment_count, segment_count}};
9494

9595
EXPECT_THAT(progresses, ElementsAreArray(progresses_expected));

test/it/v1/TestHybridSearch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ TEST_F(MilvusMockedTest, HybridSearch) {
193193

194194
// ids, topk and scores
195195
results->mutable_topks()->Add(3);
196-
for (auto id : expected_ids) {
196+
for (const auto& id : expected_ids) {
197197
results->mutable_ids()->mutable_str_id()->add_data(id);
198198
}
199199
for (auto score : expected_scores) {

test/it/v1/TestLoadPartitions.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ TEST_F(MilvusMockedTest, LoadPartitionsWithQueryStatusTimeout) {
188188
return ::grpc::Status{};
189189
});
190190

191-
auto started = std::chrono::steady_clock::now();
192191
auto status = client_->LoadPartitions(collection, partitions, 2, progress_monitor);
193-
auto finished = std::chrono::steady_clock::now();
194-
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(finished - started).count();
195192

196193
EXPECT_FALSE(status.IsOk());
197194
EXPECT_EQ(status.Code(), StatusCode::TIMEOUT);

test/it/v1/TestQueryIterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEST_F(MilvusMockedTest, QueryIterator) {
7474
uint64_t session_ts = 999999;
7575
bool is_seek = false;
7676
uint64_t query_limit = 0;
77-
for (auto pair : params) {
77+
for (const auto& pair : params) {
7878
if (pair.key() == milvus::LIMIT) {
7979
query_limit = std::atoi(pair.value().c_str());
8080
if (query_limit == 1) {

test/it/v1/TestSearchIterator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ DoSearchIterator(testing::StrictMock<milvus::MilvusMockedService>& service, milv
7878
}
7979

8080
auto params = request->search_params();
81-
for (auto pair : params) {
81+
for (const auto& pair : params) {
8282
if (pair.key() == milvus::TOPK) {
8383
EXPECT_GE(std::stoul(pair.value()), batch_size);
8484
}
@@ -144,6 +144,7 @@ DoSearchIterator(testing::StrictMock<milvus::MilvusMockedService>& service, milv
144144
}
145145

146146
std::vector<float> vector;
147+
vector.reserve(milvus::T_DIMENSION);
147148
for (auto i = 0; i < milvus::T_DIMENSION; i++) {
148149
vector.push_back(1.0);
149150
}

0 commit comments

Comments
 (0)