325 Commits
Author SHA1 Message Date
yanliang567andGitHub c61863f419 test: Add bulk insert UTF-8 coverage (#50746)
## Summary

Add UTF-8 coverage to the existing all-field parquet bulk insert test.

- Add opt-in UTF-8 string generation for parquet bulk insert data.
- Enable UTF-8 generation in the existing all-field parquet case.
- Validate imported UTF-8 values for VARCHAR, analyzer-enabled VARCHAR,
ARRAY<VARCHAR>, and JSON fields.

issue: #50745

## Test Plan

- [x] `python -m py_compile
tests/python_client/common/bulk_insert_data.py
tests/python_client/testcases/test_bulk_insert.py`
- [x] `git diff --check`
- [x] `python -W ignore -m pytest
'testcases/test_bulk_insert.py::TestBulkInsert::test_bulk_insert_all_field_with_parquet[False-False-False-False-False-2000-128-False]'
--host 10.104.26.151 --port 19530 --minio_host 10.104.26.126
--minio_bucket yanliang-26x -q`

Signed-off-by: Yanliang Qiao <yanliang.qiao@zilliz.com>
2026-06-24 19:20:25 +08:00
yanliang567andGitHub d2bf17e734 test: Add external table add field E2E tests (#50420)
Related to #50416

### What changed

- Add MilvusClient E2E coverage for external table
`add_collection_field` on scalar and vector fields.
- Cover refresh/load/search/query behavior after adding fields,
including about 10% NULL values in newly added scalar/vector fields.
- Add non-Parquet source coverage for add scalar field on Lance,
Iceberg, and Vortex.
- Add full supported DataType matrix coverage for external add field,
including scalar, array, geometry, and vector fields.
- Add negative coverage for missing/duplicate `external_field`, type/dim
mismatch, unsupported public data types, add/drop function, and drop
field APIs.
- Update Python client test dependency pin to `pymilvus==3.1.0rc35`.

### Verification

- `python -m py_compile
tests/python_client/milvus_client/test_milvus_client_external_table.py
tests/python_client/common/external_table_common.py
tests/python_client/base/client_v2_base.py
tests/python_client/check/func_check.py`
- `python -m ruff check
tests/python_client/milvus_client/test_milvus_client_external_table.py
tests/python_client/common/external_table_common.py
tests/python_client/base/client_v2_base.py
tests/python_client/check/func_check.py`
- `python -m pytest -n 4
milvus_client/test_milvus_client_external_table.py --host 10.104.18.101
--port 19530 --minio_host 10.104.18.27 --minio_bucket yanliang-mas2
--tb=short -q -s`

Result:

```text
182 passed, 1 xfailed in 318.94s (0:05:18)
```

The xfailed case is linked to #50416 and validates that old-field search
still works before the server returns the current internal QueryNode
assert for newly added fields before refresh.

---------

Signed-off-by: Yanliang Qiao <yanliang.qiao@zilliz.com>
2026-06-17 14:02:23 +08:00
zhuwenxingandGitHub 3517b1ec90 test: use rjieba for jieba tokenizer tests (#50180)
## What

Switch Python test-side Jieba usage from the Python `jieba` package to
`rjieba`, the Python binding for `jieba-rs`.

## Changes

- Replace Python test requirements from `jieba==0.42.1` to
`rjieba==0.1.11`
- Update Python client and REST test helpers to call `rjieba.cut`,
`rjieba.cut_for_search`, and `rjieba.cut_all`
- Update analyzer expected-token helper to use `rjieba` for supported
mode/hmm cases
- Keep custom-dictionary validation focused on analyzer output because
`rjieba` does not expose dynamic dictionary APIs like Python
`jieba.add_word` or `set_dictionary`

## Test

- `git diff --check`
- `python3 -m py_compile tests/python_client/common/common_func.py
tests/python_client/common/phrase_match_generator.py
tests/restful_client_v2/utils/utils.py
tests/python_client/milvus_client/test_milvus_client_analyzer.py`
- `rjieba` API smoke test
- Against `struct-hybrid-master-d44e5bc` at `10.100.36.224:19530`:
  - `TestMilvusClientAnalyzer::test_jieba_custom_analyzer`: 6 passed
  - `TestMilvusClientAnalyzer::test_analyzer`: 3 passed

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-06-01 10:36:14 +08:00
131e2d0aee test: Add testcases for external table (#49378)
## Summary

- Expand Python MilvusClient external_table E2E coverage for schema
validation, lifecycle, DQL, refresh, indexing, read-only/write-blocked
behavior, and multi-format datasets.
- Cover parquet, lance-table, iceberg-table, and vortex basic format
flows with shared data builders and stricter assertions.
- Add REST v2 external collection coverage for external job APIs,
nullable vectors, custom database flow, and format matrix behavior.
- Move Vortex data generation to the Python 3.12 test environment and
remove the old sidecar helper scripts.
- Add Python 3.12 environment setup in `tests/scripts` so E2E scripts
create and activate the expected test runtime.

## Notes

- Vortex full-matrix coverage excludes fields that the current
`vortex-data==0.56.0` writer or Milvus refresh path cannot represent
consistently (`FixedSizeBinary`-backed vector fields and known
string/JSON fields).
- Chaos fault-injection coverage is included in the PR but was not run
against the shared validation instance because it mutates the
deployment.

## Validation

- `uv venv -p 3.12 .venv`
- `uv pip install --python .venv/bin/python -r requirements.txt`
- `pytest -q -x -n 6 milvus_client/test_milvus_client_external_table.py
--host 10.100.36.207 --port 19530 --minio_host 10.100.36.172
--minio_bucket external-table-pr49378-master`
  - `162 passed, 2 skipped in 176.78s`
- `pytest -q -x -n 6 testcases/test_external_collection_operations.py
--endpoint http://10.100.36.207:19530 --token root:Milvus --minio_host
10.100.36.172 --bucket_name external-table-pr49378-master`
  - `22 passed, 4 xfailed in 66.04s`
- `git diff --check`

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-19 14:16:29 +08:00
8f09efda8f test: expand CDC replication test coverage across features and chaos scenarios (#49043)
## Summary

Extends the CDC (replication) e2e test suite with comprehensive
cross-feature coverage and switchover/failover scenarios on top of
#45624.

## What's Added

### New test files (\`tests/python_client/cdc/testcases/\`)
- \`test_fts_and_text.py\` — BM25 search, text_match, phrase_match,
hybrid FTS+dense, FTS after switchover (5 tests × 2 analyzers)
- \`test_schema_features.py\` — dynamic schema, nullable, defaults,
partition key, clustering key, combined features (7 tests)
- \`test_collection_properties.py\` — TTL, mmap, autocompaction,
multi-property, drop property (5 tests)
- \`test_resource_group.py\` — create, drop, update, transfer replica (4
tests)
- \`test_multi_database.py\` — cross-DB collections, drop DB with
collections, cross-DB operations (3 tests)
- \`test_search_verification.py\` — 6 tests × 7 vector types (search
result consistency, query data sampling, hybrid search, iterators,
filtered search)
- \`test_switchover.py\` — basic, during-writes, all-types, loaded,
indexed, rapid stress, failover (7 tests)

### Shared utilities
- \`base.py\`: +7 schema factories, +4 data generators, +4 verification
helpers, +2 constants
- \`conftest.py\`: +\`switchover_helper\` fixture,
+\`--is-check\`/\`--milvus-ns\` options

## Test plan
- [ ] Run \`pytest tests/python_client/cdc/testcases/\` against
two-cluster CDC deployment
- [ ] Verify each test file runs independently via \`pytest
testcases/test_<name>.py\`
- [ ] Companion PR in zilliztech/test-jobs adds Jenkins pipelines to run
these

issue: #49042
pr: #45624

/kind test
/kind improvement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Yihao Dai <yihao.dai@zilliz.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-28 10:29:50 +08:00
72e53e3d99 test: add cdc e2e testcases (#45624)
/kind improvement

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 14:05:41 +08:00
0a689a7d67 test: update default_nb from 2000 to 3000 across all test modules (#48787)
## Summary

- Update `default_nb` from 2000 to 3000 across Python client, RESTful
v2, and index test modules
- Index creation requires > 2048 rows, so the previous default of 2000
was insufficient
- Replace hardcoded `nb=2000` with `ct.default_nb` references for better
maintainability
- Add `default_nb` constant to RESTful v2 and replace hardcoded
`nb=100`/`nb=200` with `nb=3000`

## Changes

| Module | Change |
|--------|--------|
| `python_client/common/common_type.py` | `default_nb = 2000` → `3000` |
| `python_client/testcases/indexes/*` | 7 files: local `default_nb =
2000` → `ct.default_nb` |
| `python_client/milvus_client/*` | 5 files: hardcoded `nb=2000` →
`ct.default_nb` |
| `python_client/milvus_client_v2/*` | 6 files: hardcoded `nb=2000` →
`ct.default_nb` |
| `python_client/testcases/*` | 3 files: hardcoded `nb=2000` →
`ct.default_nb` |
| `restful_client_v2/utils/constant.py` | Added `default_nb = 3000` |
| `restful_client_v2/base/testbase.py` | `init_collection` default
`nb=100` → `nb=3000` |
| `restful_client_v2/utils/utils.py` | `get_data_by_payload` default
`nb=100` → `nb=3000` |
| `restful_client_v2/testcases/*` | 4 files: hardcoded `nb=100`/`nb=200`
→ `nb=3000` |

issue: https://github.com/milvus-io/milvus/issues/42446

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 14:25:39 +08:00
nicoandGitHub 8137ebcea1 test: Fix 20 nightly e2e cases broken by test code bugs (#48842)
## Summary

Two unrelated test code bugs caused 20 e2e cases to fail in master
nightly #664, reproducing in **both** `distributed-pulsar-mmap` and
`distributed-woodpecker` configurations. Both root causes are pure
test-code issues — no Milvus server change required.

issue: #48841

## Root Causes & Fixes

### A1 — `test_range_search_after_different_index_with_params` (8 cases)

`cf.get_search_params_params(index)` returns the **inner** params dict
(e.g. `{"nprobe": 32}`), not a wrapped `{"params": {...}}`. All other 16
callers in the repo wrap it themselves, but this call site at
`test_milvus_client_range_search.py:1251-1252` wrongly accessed
`search_params["params"]`, causing `KeyError: 'params'`.

The same file at line 672-678 already shows the **correct** pattern. Fix
matches it:

```diff
-        search_params = cf.get_search_params_params(index)
-        search_params["params"].update({"radius": 2, "range_filter": 0.1})
+        params = cf.get_search_params_params(index)
+        params.update({"radius": 2, "range_filter": 0.1})
+        search_params = {"params": params}
```

### A2 — `test_search_after_{none,default}_data_all_field_datatype` (12
cases)

`gen_default_rows_data_all_data_type` at `common/common_func.py:1703`
assigned the row index `i` directly to the int8 field. At `i=128` it
overflowed `int8 [-128, 127]` and the server rejected insert with:

```
MilvusException(code=1100, message=the 128th element (128) out of range:
[-128, 127]: invalid parameter[expected=integer doesn't overflow][actual=out of range])
```

Wrap with `np.int8(i)` to keep the sequential property while staying in
range. `i=128 → -128`, `i=255 → -1`, `i=256 → 0`. Existing assertions
like `int8 == 8` for row 8 still hold (8 is unchanged).

```diff
-                ct.default_int8_field_name: i,
+                ct.default_int8_field_name: int(np.int8(i)),
```

Note: `gen_row_data_by_schema()` (a different helper) already uses
`random.randint(-128, 127)` correctly. Only
`gen_default_rows_data_all_data_type()` was buggy.

## Test Plan

Verified locally against `master-20260408-151dc63` on a real Milvus
cluster:

| Group | Before | After | Duration |
|---|---|---|---|
| A1 (8 cases) | 0/8 PASS | **8/8 PASS** | 22s |
| A2 (12 cases) | 0/12 PASS | **12/12 PASS** | 39s |

- [x] A1: `pytest milvus_client_v2/test_milvus_client_range_search.py -k
test_range_search_after_different_index_with_params -n 4` → 8 passed
- [x] A2: `pytest
milvus_client_v2/test_milvus_client_search_none_default.py -k
"test_search_after_none_data_all_field_datatype or
test_search_after_default_data_all_field_datatype" -n 4` → 12 passed
- [x] Reproduced original failures before fix to confirm root cause
- [ ] Nightly CI green after merge

## Related

- Issue: milvus-io/milvus#48841
- Nightly build:
https://jenkins.milvus.io:18080/job/Milvus%20Nightly%20CI(new)/job/master/664/

Signed-off-by: nico <cheng.yuan@zilliz.com>
2026-04-09 10:51:38 +08:00
wtandGitHub 7aa8f374c0 test: add warmup e2e tests covering async/sync/disable policies at field/collection/index levels (#48726)
## Summary

- Add `TestMilvusClientWarmupAsync` class with 30+ async warmup test
cases covering field/collection/index level warmup, hasRawData=false
paths (IVF_PQ, IVF_SQ8, sparse), cross-feature combos (mmap, partition,
multi_vector, dynamic, text_match, JSON, add_field), DQL/DML
correctness, and bug-finding cases (cancel/reload, priority chain,
sync-vs-async result identity)
- Fix index-before-insert ordering bug in 4 existing
`TestMilvusClientWarmup` cases
- Add `@pytest.mark.skip` guards for L3 tiered-storage-dependent cases
- Remove unused variables and dead code

## Test plan

- [x] Run `TestMilvusClientWarmup` + `TestMilvusClientWarmupAsync` with
`-n 6 --host=10.104.24.55`
- [x] Result: 131 passed, 6 skipped (L3), 1 failed
(`test_warmup_x_multi_replica` — requires multi-replica cluster,
unrelated to this PR)
- [ ] L3 cases verified separately on tiered storage instance and
`lowPriority=0` instance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
2026-04-08 09:37:37 +08:00
3af5fe71e3 test: rewrite scalar expression filtering tests with eval ground truth and bug regression (#48450)
## Summary
- Rewrite `test_milvus_client_scalar_filtering.py` (2156→1567 lines)
with eval-based ground truth, deterministic boundary values, and
comprehensive operator/type coverage
- Add `NullValue` sentinel class in `common_func.py` for SQL NULL 3VL
semantics (reusable across test files)
- 4 focused test classes replacing 1 monolithic class: Correctness,
IndexConsistency, CornerCase (bug regression), JSON

## Why
The original test had fundamental gaps discovered while analyzing real
bugs:
- **No boundary values** (INT64_MAX/MIN, 2^53) → missed #48440
(overflow)
- **No ground truth** (only self-consistency) → couldn't detect wrong
results from all code paths
- **Hand-written validators** with incorrect NULL handling → false
passes
- **No NOT+AND+OR compound coverage** → missed #48441 (3VL bitmap)
- **No bool literal / mixed-type IN tests** → missed #48443, #48442

## What's covered now

**Type coverage**: INT8/16/32/64, FLOAT, DOUBLE, BOOL, VARCHAR, JSON,
ARRAY(INT8/16/32/64/FLOAT/DOUBLE/BOOL/VARCHAR)

**Operator coverage**: `==, !=, >, <, >=, <=, IN, NOT IN, LIKE (12
patterns), IS NULL, IS NOT NULL, +, -, *, /, %, **, array_contains,
array_contains_all, array_contains_any, array_length, json path,
json_contains`

**Compound expressions**: AND, OR, NOT, &&, ||, NOT+AND, NOT+OR, triple
nesting, DeMorgan, double NOT, 3-way AND/OR, cross-field, range patterns

**Index consistency**: INVERTED, BITMAP, STL_SORT, TRIE — verified with
both cross-index comparison AND ground truth

**Bug regression (L0)**: #48440 overflow (+,-,*), #48441 3VL
NOT+nullable (incl. all-NULL segment), #48442 JSON mixed-type IN
precision, #48443 bool literal parser

## Test results (master-20260318-3ec434d)
```
37 tests: 32 passed, 5 failed (all real Milvus bugs)
L0+L1 (19 tests, -n 4): 37 seconds
```

| Failed test | Issue |
|---|---|
| test_int64_overflow_addition | #48440 |
| test_int64_overflow_subtraction | #48440 |
| test_3vl_not_all_null_segment | #48441 |
| test_bool_literal_in_logical_expr | #48443 |
| test_json_mixed_type_in_precision | #48442 |

## Tag distribution
- **L0 (7)**: Bug regression — every PR must run
- **L1 (12)**: Core type correctness + compound + index consistency
- **L2 (18)**: Extended types + all arrays + JSON path/contains

issue: #48048

## Test plan
- [x] L0+L1 pass (minus known Milvus bugs)
- [x] L2 pass
- [x] Eval engine verified: SQL NULL 3VL, NOT propagation, NOT IN, IS
NULL/IS NOT NULL
- [x] No false passes: parser errors → pytest.fail, skip rate tracking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 15:17:38 +08:00
519719f7f8 test: Fix search_v2 series verification and add index constant (#48345)
## Summary
- Add `ct.all_dense_float_index_types` constant (replaces fragile `[:8]`
slices)
- Fix metric, duplicate keys, GPU→L1, IVF_FLAT→FLAT, spelling

issue: #48048
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 16:17:27 +08:00
96615cce41 test: add MinHash DIDO function test suite (#47324)
/kind improvement

add testcases and fix a related issue

issue: #47928

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 17:17:30 +08:00
d1be390452 test: Migrate partition key test cases from v1 ORM to v2 MilvusClient (#48182)
## Summary
- Migrate 15 partition key test cases from
`testcases/test_partition_key.py` (v1 ORM style) to
`milvus_client/test_milvus_client_partition_key.py` (v2 MilvusClient
style)
- Migrate 4 partition key isolation test cases from
`testcases/test_partition_key_isolation.py` to
`milvus_client/test_milvus_client_partition_key_isolation.py`
- Optimize isolation test parameters to prevent CI timeout: data_size
10000→1000, dim 768→128, HNSW M=30→16, efConstruction=360→64
- Remove migrated v1 test files

## Related Issues
#48048

## Test plan
- [x] All 19 migrated test cases (46 parametrized combinations) pass on
cluster (19531)
- [x] Partition key isolation tests (4 cases) all pass (~68s total, down
from >360s CI timeout)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 10:39:39 +08:00
260c312da7 test: Migrate partition test cases from v1 ORM to v2 MilvusClient (#48138)
## Summary
- Migrate 50+ partition test cases from `testcases/test_partition.py`
(v1 ORM style) to `milvus_client/test_milvus_client_partition.py` (v2
MilvusClient style)
- Add `gen_default_rows_data_for_upsert` helper in `common_func.py` for
row-based upsert data generation
- Enhance existing v2 tests with partition name validation and `None`
partition name coverage
- Remove migrated test cases from v1 file, keeping only v2-incompatible
cases (description params, dataframe insert)

## Related Issues
#48048

## Test plan
- [x] v1 remaining tests pass on standalone (19530) and cluster (19531)
- [x] v2 full test suite passes on standalone (148 passed, 3 failed -
replica tests need cluster)
- [x] v2 full test suite passes on cluster (151 passed, 0 failed)
- [x] v2 tests pass with 8-worker concurrency (`-n 8`) on both
environments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:01:24 +08:00
zhuwenxingandGitHub c5102683d3 enhance: increase default maxVectorFieldNum from 4 to 10 (#47866)
## Summary
- Increase the default `maxVectorFieldNum` from **4** to **10** to
accommodate the growing variety of vector types (dense, sparse,
function-based) supported by Milvus
- Update related test constants and hardcoded values in both Go and
Python test suites

## Changes
- `configs/milvus.yaml`: default config value 4 → 10
- `pkg/util/paramtable/component_param.go`: Go param default "4" → "10"
- `tests/go_client/common/consts.go`: Go test constant 4 → 10
- `tests/python_client/common/common_type.py`: Python test constant 4 →
10
- `tests/python_client/milvus_client/test_milvus_client_collection.py`:
replace hardcoded "4" in error message with constant reference

Closes #47402

## Test plan
- [x] Verify collection creation with up to 10 vector fields succeeds
- [x] Verify collection creation with 11+ vector fields fails with
proper error message
- [x] Run existing Go integration tests (`tests/go_client`)
- [x] Run existing Python client tests (`tests/python_client`)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-02-26 14:18:47 +08:00
wtandGitHub 447db2816d test: add e2e tests for warmup feature at field/collection/index levels (#47764)
## Summary

Add 25 e2e test cases (38 with parametrization) for the warmup feature,
covering field/collection/index level warmup configuration and
cross-feature interactions.

### Test Coverage

- **Schema-level**: `add_field(warmup=sync/disable)` for all data types
- **Collection-level**: `warmup.scalarField / vectorField / scalarIndex
/ vectorIndex` properties
- **Index-level**: `alter_index_properties` warmup lifecycle
(set/update/drop)
- **Priority**: three-level priority (field/index > collection >
cluster), index overrides collection
- **Cross-feature**: warmup × mmap, partition, compaction,
multi-replica, growing segment, dynamic field, multi-vector fields
- **Negative cases**: invalid values, wrong-level keys
- **Idempotency & boundary**: create_index idempotent behavior,
drop/recreate residue check, empty collection, toggle repeatedly

### Changes

**Modified Files:**
- `tests/python_client/common/common_func.py`: Add 3 warmup helper
functions (`get_field_warmup`, `get_collection_warmup`,
`get_index_warmup`)
- `tests/python_client/milvus_client/test_milvus_client_alter.py`: Add
`TestMilvusClientWarmup` test class with 25 test methods

### Test Plan

- [x] All 38 tests passed locally with `-n 6` parallel execution (100s)
- [x] Tested against Milvus master branch with pymilvus 2.6.9

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
2026-02-13 11:08:42 +08:00
9ef7e25778 test: enable search by ids on null vectors tests for #47065 (#47559)
## Summary
- Enable search by ids tests that were commented out pending fix of
#47065
- Fix syntax error in test: `for i in len()` → `for i in range(len())`
- Update test expectations to match the fixed behavior:
  - Search on null vectors now returns empty results instead of error
- Fix assertion to use correct `num_entities_with_not_null_vector` count

## Test plan
- [x] `test_milvus_client_add_nullable_vector_field_search` - verified
passing
- [x] `test_milvus_client_collection_null_vector_field_search` -
verified passing

issue: #47065

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Signed-off-by: Yan Liang <yanliang@zilliz.com>
Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:17:49 +08:00
zhuwenxingandGitHub fc11816690 test: add test cases for alter function with invalid mock (#46995)
## Summary
- Add mock TEI server utility (`common/mock_tei_server.py`) for testing
text embedding functions
- Add test cases for PR #46984 fix (alter function when other function
is invalid)

## Test Cases
1. `test_alter_function_when_other_function_is_invalid` - Verify that
altering a valid function succeeds even when another function in the
collection is invalid
2. `test_alter_invalid_function_to_valid_endpoint` - Verify that users
can fix an invalid function by altering it to a valid endpoint

## Related Issues
- Issue: https://github.com/milvus-io/milvus/issues/46949
- Fix PR: https://github.com/milvus-io/milvus/pull/46984

## Test Plan
- [x] Verified test fails with unfixed Milvus
(`master-20260112-7bcd3b10`)
- [x] Verified test passes with fixed Milvus (`master-20260112-b39ecb0`)

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-02-03 16:29:59 +08:00
yanliang567andGitHub bdb56f6053 enhance: Optimize Python test logging from 60MB to 3-5MB per run (#47253)
## Summary

This PR optimizes Python test logging to reduce log file size from 60MB+
to 3-5MB per test run (90%+ reduction) while preserving full debugging
information for failed tests.

related issue:  #47256

### Key Improvements

- **Conditional Logging**: PASSED tests save only metadata, FAILED tests
preserve complete logs
- **Memory Buffering**: Eliminates runtime disk I/O (no file writes
during test execution)
- **Unified Reports**: Generates 2 formats
  - `test_report.json`: AI-friendly structured data
  - `test_report.html`: Human-readable with color-coded logs
- **Worker Parallelism**: Full support for `pytest -n` with data merging

### Performance Impact

| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| **Log Size** (15K tests) | 60 MB | 3-5 MB | **-90%+** |
| **Memory Usage** (6 workers) | ~50 MB | ~450 MB | +400 MB |
| **CPU Overhead** | N/A | 0.0004% | Negligible |
| **Runtime I/O** | 75 seconds | 75 ms | **-99.9%** |

### Changes

**New Files:**
- `plugin/log_filter.py`: Conditional log handler with per-test memory
buffers
- `plugin/__init__.py`: Plugin package initialization

**Modified Files:**
- `config/log_config.py`: Simplified config (only JSON/HTML paths)
- `conftest.py`: Register log filter plugin
- `utils/util_log.py`: Removed redundant file handlers
- `utils/api_request.py`: Optimized API request logging
- `check/param_check.py`: Truncate long lists in error messages
- `common/common_func.py`: Removed verbose logging
- `pytest.ini`: Added log filter plugin

**Cleanup:**
- `milvus_client/test_add_field_feature.py`: Removed unused variable

### Test Plan

- [x] Syntax validation: All Python files pass `py_compile`
- [x] Module imports: All modules load successfully
- [x] Data structures: Verified serialization without report/buffer
objects
- [x] Log configuration: Confirmed only necessary attributes present
- [x] Small-scale test (17 tests):  Generated correct JSON + HTML
reports
- [x] Performance analysis: Memory/CPU profiling for 15K test scenario

### Example Output

**test_report.html** (human-readable):
- Beautiful color-coded UI
- Failed tests with full error traceback
- Expandable log sections by level (debug/info/warning/error)

**test_report.json** (AI-friendly):
```json
{
  "metadata": { "total_tests": 15000, ... },
  "summary": { "passed": 13500, "failed": 1500, ... },
  "tests": {
    "failed": [
      {
        "id": "test.py::test_func",
        "error": { "type": "AssertionError", ... },
        "logs": { "debug": [...], "error": [...] }
      }
    ]
  }
}
```

### Memory Safety

For the standard scenario (15K tests, 10% failure, 6 workers):
- Worker memory: ~53 MB each (318 MB total)
- Main process peak: ~112 MB
- Total system: **< 450 MB**  Safe

High-risk scenarios (>30% failure or >50K tests) may require optional
streaming optimizations (documented in performance analysis).

### Backward Compatibility

-  No breaking changes to external APIs
-  Existing test commands work unchanged
-  Compatible with all pytest plugins

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2026-01-27 16:37:33 +08:00
yanliang567andGitHub 15ce8aedd8 test: Add some tests for group by search support json and dynamic field (#46630)
related issue: #46616


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
- Core invariant: these tests assume the v2 group-by search
implementation (TestMilvusClientV2Base and pymilvus v2 APIs such as
AnnSearchRequest/WeightedRanker) is functionally correct; the PR extends
coverage to validate group-by semantics when using JSON fields and
dynamic fields (see
tests/python_client/milvus_client_v2/test_milvus_client_search_group_by.py
— TestGroupSearch.setup_class and parametrized group_by_field cases).
- Logic removed/simplified: legacy v1 test scaffolding and duplicated
parametrized fixtures/test permutations were consolidated into
v2-focused suites (TestGroupSearch now inherits TestMilvusClientV2Base;
old TestGroupSearch/TestcaseBase patterns and large blocks in
test_mix_scenes were removed) to avoid redundant fixture permutations
and duplicate assertions while reusing shared helpers in common_func
(e.g., gen_scalar_field, gen_row_data_by_schema) and common_type
constants.
- Why this does NOT introduce data loss or behavior regression: only
test code, test helpers, and test imports were changed — no
production/server code altered. Test helper changes are
backward-compatible (gen_scalar_field forces primary key nullable=False
and only affects test data generation paths in
tests/python_client/common/common_func.py; get_field_dtype_by_field_name
now accepts schema dicts/ORM schemas and is used only by tests to choose
vector generation) and collection creation/insertion in tests use the
same CollectionSchema/FieldSchema paths, so production
storage/serialization logic is untouched.
- New capability (test addition): adds v2 test coverage for group-by
search over JSON and dynamic fields plus related scenarios — pagination,
strict/non-strict group_size, min/max group constraints, multi-field
group-bys and binary vector cases — implemented in
tests/python_client/milvus_client_v2/test_milvus_client_search_group_by.py
to address issue #46616.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-12-31 11:03:21 +08:00
marcelo-cjlandGitHub 3b599441fd feat: Add nullable vector support for proxy and querynode (#46305)
related: #45993 

This commit extends nullable vector support to the proxy layer,
querynode,
and adds comprehensive validation, search reduce, and field data
handling
    for nullable vectors with sparse storage.
    
    Proxy layer changes:
- Update validate_util.go checkAligned() with getExpectedVectorRows()
helper
      to validate nullable vector field alignment using valid data count
- Update checkFloatVectorFieldData/checkSparseFloatVectorFieldData for
      nullable vector validation with proper row count expectations
- Add FieldDataIdxComputer in typeutil/schema.go for logical-to-physical
      index translation during search reduce operations
- Update search_reduce_util.go reduceSearchResultData to use
idxComputers
      for correct field data indexing with nullable vectors
- Update task.go, task_query.go, task_upsert.go for nullable vector
handling
    - Update msg_pack.go with nullable vector field data processing
    
    QueryNode layer changes:
    - Update segments/result.go for nullable vector result handling
- Update segments/search_reduce.go with nullable vector offset
translation
    
    Storage and index changes:
- Update data_codec.go and utils.go for nullable vector serialization
- Update indexcgowrapper/dataset.go and index.go for nullable vector
indexing
    
    Utility changes:
- Add FieldDataIdxComputer struct with Compute() method for efficient
      logical-to-physical index mapping across multiple field data
- Update EstimateEntitySize() and AppendFieldData() with fieldIdxs
parameter
    - Update funcutil.go with nullable vector support functions

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Full support for nullable vector fields (float, binary, float16,
bfloat16, int8, sparse) across ingest, storage, indexing, search and
retrieval; logical↔physical offset mapping preserves row semantics.
  * Client: compaction control and compaction-state APIs.

* **Bug Fixes**
* Improved validation for adding vector fields (nullable + dimension
checks) and corrected search/query behavior for nullable vectors.

* **Chores**
  * Persisted validity maps with indexes and on-disk formats.

* **Tests**
  * Extensive new and updated end-to-end nullable-vector tests.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: marcelo-cjl <marcelo.chen@zilliz.com>
2025-12-24 10:13:19 +08:00
a7eb327746 test: fix unstable timestamptz test cases (#46403)
Issue: #46333 

test: re-write convert timestamp logic to cover daylight saving time

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2025-12-17 21:13:16 +08:00
624147740b test: fix timestamptz e2e case failure on Jenkins Weekly (#46210)
Issue: #46188 

Bug was caused by inconsistent version of tzdata as well as wrong month
assignment in convert_timestamptz function.
Also fix when debug_mode=True the compare function can correctly return
True or False.

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2025-12-09 16:09:15 +08:00
228eb0f5d0 test: add more test cases and add bulk insert scenario (#45770)
Issue: #45756 
1. add bulk insert scenario
 2. fix small issue in e2e cases
 3. add search group by test case
 4. add timestampstz to gen_all_datatype_collection_schema
5. modify partial update testcase to ensure correct result from
timestamptz field

 On branch feature/timestamps
 Changes to be committed:
	modified:   common/bulk_insert_data.py
	modified:   common/common_func.py
	modified:   common/common_type.py
	modified:   milvus_client/test_milvus_client_partial_update.py
	modified:   milvus_client/test_milvus_client_timestamptz.py
	modified:   pytest.ini
	modified:   testcases/test_bulk_insert.py

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2025-11-24 15:21:06 +08:00
0231a3edf8 test: enable all timestamptz case (#45128)
Issue: #44518

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2025-11-21 11:03:06 +08:00
zhuwenxingandGitHub e0df44481d test: refactor checker to using milvus client (#45524)
/kind improvement

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-11-20 11:59:08 +08:00
zhuwenxingandGitHub 06933c25b8 test: add geometry datatype in import testcases (#45014)
/kind improvement

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-11-04 16:55:33 +08:00
zhuwenxingandGitHub a03c398986 test: add import case for struct array (#45146)
/kind improvement

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-11-03 17:19:39 +08:00
zhuwenxingandGitHub a47c168dd7 test: add json dumps for json string data (#45189)
/kind improvement

issue: https://github.com/milvus-io/milvus/issues/44982

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-11-03 10:37:33 +08:00
zhuwenxingandGitHub 1e130683be test: add geometry datatype in checker (#44794)
/kind improvement

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-10-24 11:28:04 +08:00
16ff5db79d test: Add e2e case for timestamptz (currently skipping them) (#44871)
Issue: #44518

On branch feature/timestamps
Changes to be committed:
    modified: common/common_func.py
    new file: milvus_client/test_milvus_client_timestamptz.py

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2025-10-20 10:04:02 +08:00
2f178f810f fix:fix json_contains(path, int) bug (#44814)
#44816

Signed-off-by: luzhang <luzhang@zilliz.com>
Co-authored-by: luzhang <luzhang@zilliz.com>
2025-10-14 00:19:59 +08:00
f9afde23d1 test: Add New Test Cases for Partial Update (#44483)
Issue: #43872 
<fix>: <fix after accidental force pull>

 Changes to be committed:
	modified:   chaos/checker.py
	modified:   chaos/testcases/test_single_request_operation.py
	modified:   common/common_func.py
	modified:   common/common_type.py
	modified:   milvus_client/test_milvus_client_insert.py

This includes e2e cases and chaos checker.
All the cases are currently skipped due to partial update feature not
ready.

1. test_milvus_client_partial_update_insert_delete_upsert_with_flush():
insert -> delete -> flush -> query -> upsert -> flush -> query
2.
test_milvus_client_partial_update_insert_upsert_delete_upsert_flush():
insert -> upsert -> delete -> upsert -> flush -> query
3.
test_milvus_client_partial_update_insert_upsert_flush_delete_upsert_flush():
insert -> upsert -> flush -> delete -> upsert -> flush -> query Also
update requirements.txt to use latest pymilvus version

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2025-09-23 09:06:12 +08:00
wei liuandGitHub 18371773dd enhance: Optimize partial update merge logic by unifying nullable format (#44197)
issue: #43980
This commit optimizes the partial update merge logic by standardizing
nullable field representation before merge operations to avoid corner
cases during the merge process.

Key changes:
- Unify nullable field data format to FULL FORMAT before merge execution
- Add extensive unit tests for bounds checking and edge cases

The optimization ensures:
- Consistent nullable field representation across SDK and internal
- Proper handling of null values during merge operations
- Prevention of index out-of-bounds errors in vector field updates
- Better error handling and validation for partial update scenarios

This resolves issues where different nullable field formats could cause
merge failures or data corruption during partial update operations.

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
2025-09-10 17:27:56 +08:00
yanliang567andGitHub ec6681b018 test: add tests for ngram and fix invalid collection name mag (#43990)
related issue: #43989

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-08-21 18:45:47 +08:00
yanliang567andGitHub d45274512c test: Refactor search tests and remove useless common functions (#43608)
related issue: #40698

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-08-05 11:15:39 +08:00
qixuanandGitHub 3d8f728091 test: modify add field case about skipped cases (#43461)
related issue: #42126

Signed-off-by: qixuan <673771573@qq.com>
2025-07-24 14:26:54 +08:00
yanliang567andGitHub abb3aeacdf test: Refactor diskann and hsnw index, and update gen data functions (#43452)
related issue #40698
1. add diskann and hnsw index test
2. update gen_row_data and gen_column_data functions

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-07-23 22:04:54 +08:00
qixuanandGitHub 1cd593b673 test:add go sdk case for add field (#43033)
issue: #42126

Signed-off-by: qixuan <673771573@qq.com>
2025-07-09 18:20:47 +08:00
yanliang567andGitHub e8011908ac test: Add tests for partition key filter issue and ttl eventually search (#43052)
related issue: #42918
1. add tests for ttl eventually search
2. add tests for partition key filter 
3. improve check query results for output fields 
4. verify some fix for rabitq index and update the test accordingly
5. update gen random float vector in (-1, 1) instead of (0,1)

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-07-02 11:02:43 +08:00
zhuwenxingandGitHub b043ff14c2 test: add add_collection_field feature in checker for chaos test (#42085)
/kind improvement

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-06-20 15:24:39 +08:00
yanliang567andGitHub fb7f19dfa1 test: update ttl test comments and update for expressions tests (#42611)
related issue: #42604

1. update the test expression for all to L3 for now as it takes too many
hours to complete running. Will improve the performance in next pr.

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-06-11 16:52:38 +08:00
binbinandGitHub ceb8434cb4 test: add more general expr cases (#42035)
Signed-off-by: binbin lv <binbin.lv@zilliz.com>
2025-05-28 22:26:28 +08:00
zhuwenxingandGitHub bfa948c2d4 test: Add int8 vector field support in search checker (#42047)
/kind improvement

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2025-05-26 16:18:49 +08:00
binbinandGitHub eea6b50fbb test: add test cases for int8 vector (#41957)
Signed-off-by: binbin lv <binbin.lv@zilliz.com>
2025-05-23 09:24:28 +08:00
binbinandGitHub 804b175771 test: add test cases for rerank (#42012)
Signed-off-by: binbin lv <binbin.lv@zilliz.com>
2025-05-22 17:04:25 +08:00
yanliang567andGitHub f20e085b22 test: Update ivf_rabitq error msg and groupby support nullable field (#41997)
related issue: #41898

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-05-21 22:20:25 +08:00
yanliang567andGitHub d475d93a3d test: Add ivf_rabitq index tests (#41914)
related issue: #41760

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-05-20 19:28:24 +08:00
yanliang567andGitHub ee659d50db test: [E2e Refactor] update search basic tests and add a pk_name instead of hard code (#41669)
related issue: https://github.com/milvus-io/milvus/issues/40698

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-05-09 21:58:54 +08:00
yanliang567andGitHub 70b311735b test: [E2e Refactor] use vector datatype instead of hard code dataype names (#41497)
related issue: #40698 
1. use vector datat types instead of hard code datatpe names
2. update search pagination tests
3. remove checking distances in search results checking, for knowhere
customize the distances for different metrics and indexes. Now only
assert the distances are sorted correct.

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2025-04-25 10:46:38 +08:00