Commit Graph

199 Commits (17532517c611cafe5ec7a79bda47c9f296e82682)

Author SHA1 Message Date
Li Yiyang d927b95a03
test: Add RBAC prefix isolation tests (#48381)
## Summary
- Add `TestMilvusClientRbacPrefixIsolation` class to
`test_milvus_client_rbac.py`
- Validates RBAC metadata integrity and permission isolation when
usernames/roles have prefix relationships (e.g. `user1` vs `user11`),
covering issue #47998 and PR #48053
- Single test method with setup/teardown per run, using random prefix
for test data isolation

## Related Issues
issue: #47998
pr: #48053

## Test Report
https://zilliverse.feishu.cn/docx/HaFld6sCyoMz19xOsC3cPCqdncg

## Test plan
- [x] Verified on v2.6.9 (pre-fix): FAIL on #03 DescribeUser
(empty-string role) and #23 ListDatabases
- [x] Verified on master-20260319 (post-fix): all PASS
- [x] Teardown cleans up all test data using `force_drop`, no residual
data

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

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 11:27:29 +08:00
zhuwenxing 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
zhuwenxing df26144a3d
test: add struct array element search tests for phase 2 (#47688)
## Summary
- Add comprehensive test suite (~145 test methods) for struct array
element search
- Covers element_filter, MATCH_ALL/ANY/LEAST/MOST/EXACT, nested index,
non-float vectors, query, hybrid search, CRUD, iterator, and invalid
cases
- Bump pymilvus to 2.7.0rc138 for struct array fixes

/kind improvement

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 17:15:27 +08:00
Feilong Hou 9a691f0745
test: preserve dynamic field and default value during partial update (#48217)
## Summary
- Fix partial update failing when dynamic field is enabled but no
dynamic data is provided during upsert
- Fix partial update failing when field has default value but is not
nullable
- Add E2E test cases covering dynamic field and default value scenarios
for partial update

issue: https://github.com/milvus-io/milvus/issues/47957,
https://github.com/milvus-io/milvus/issues/48002

## Test plan
- [x] Added E2E tests for partial update with dynamic fields
- [x] Added E2E tests for partial update with default value fields
- [x] Verified upsert works with empty dynamic field data
- [x] Verified upsert works with non-nullable fields that have default
values

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

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 19:05:26 +08:00
Li Yiyang 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
Li Yiyang 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
sparknack 6dc8418eac
enhance: add async warmup policy support for caching layer (#47627)
issue: #47902

Integrate milvus-common commit 7b54b6e which adds
CacheWarmupPolicy_Async and a prefetch thread pool for background cache
warmup. This enables segments to be marked as loaded immediately while
cache warming happens asynchronously, reducing load latency.

---------

Signed-off-by: Shawn Wang <shawn.wang@zilliz.com>
2026-03-10 14:45:23 +08:00
Feilong Hou be76bf709f
test: add entity TTL E2E test cases (#47948)
## Summary
- Add comprehensive E2E test cases for the Entity TTL feature (#47482)
- Cover collection creation/alter with `ttl_field`, insert with
future/expired/null TTL values, upsert to extend/shorten TTL, delete
before expiry, release/reload behavior, and query/search filtering of
expired data
- Add invalid parameter test cases: non-timestamptz field, nonexistent
field, nullable=false, and conflict with collection-level TTL
- Fix existing `test_milvus_client_ttl_edge` to properly assert error on
out-of-range TTL

## Test plan
- [x] All new test cases pass against a Milvus instance with entity TTL
support enabled
- [x] Existing TTL test cases remain passing

issue: #47482

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 14:37:22 +08:00
Li Liu bac91805cd
test: fix 4 flaky tests across Go and Python (#47907)
## Summary
- **balancer_test**: use `defer b.Close()` immediately after creation in
`TestBalancer_WithRecoveryLag` to prevent goroutine leak causing DATA
RACE with next test's `resource.InitForTest()`
- **impl_test**: initialize `globalMetaCache` mock in
`TestProxyDropDatabase` to avoid nil pointer from stale global state
- **client_test**: replace `log.Fatalf` with `t.Fatalf` for listen
errors, silence `s.Serve()` return on `s.Stop()`, fix `lis.Addr()`
called before error check
- **test_milvus_client_ttl**: increase TTL from 5s to 20s with 2s margin
zones around TTL boundaries to ensure all assertion phases have
meaningful windows

## Test plan
- [ ] CI ut-go passes (covers fixes 1-3)
- [ ] CI e2e passes (covers fix 4)

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

---------

Signed-off-by: Li Liu <li.liu@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 19:03:20 +08:00
yanliang567 0748e46bed
test: Add scipy.sparse insert tests and hybrid search coverage for add_field (#47885)
## Summary

- Add E2E test coverage for **scipy.sparse** sparse vector input (insert
+ search)
- Add **hybrid search** step to existing add_vector_field test for issue
#47873 coverage

**Related issue**: #47884

### Changes

**test_milvus_client_insert.py** (+118 lines):
- `test_milvus_client_insert_sparse_vector_scipy` [L1]: direct CSR
format (`csr_matrix`, `csr_array`) insert + search
- `test_milvus_client_insert_sparse_vector_scipy_to_csr` [L2]: non-CSR
formats (`csc_matrix`, `coo_matrix`, `dok_matrix`, `lil_matrix`,
`coo_array`) converted via `.tocsr()` then insert + search

**test_add_field_feature.py** (+19 lines):
- Added hybrid search step (original + new nullable vector fields) to
existing `test_milvus_client_add_vector_field`
- Regression coverage for issue #47873 (HybridSearch on newly added
nullable vector fields after release+load)

### Test Plan

- [x] All 7 scipy.sparse format tests passed on standalone
(10.104.17.152), ~5s each
- [x] Hybrid search test passed on standalone (10.104.17.152) and
distributed (10.104.21.212)

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

Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
2026-02-28 10:57:23 +08:00
zhuwenxing 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
yanliang567 4bbc01324b
fix: handle NaN vs None comparison in output field value check for nullable fields (#47841)
## Summary

- Fix `output_field_value_check` in `param_check.py` to handle NaN vs
None comparison for nullable fields
- When nullable fields contain `None` values, `pandas.DataFrame`
converts them to `NaN`. The check function then fails comparing `NaN`
(from DataFrame) with `None` (from Milvus search results). This fix
treats both as equivalent null values.
- Remove resolved issue reference comments (`#47065`)

**Related issue**: #47065

### Changes

**Modified Files:**
- `tests/python_client/check/param_check.py`: Add NaN/None equivalence
check before asserting output field values
- `tests/python_client/milvus_client/test_add_field_feature.py`: Remove
resolved `#47065` comment
- `tests/python_client/milvus_client/test_milvus_client_collection.py`:
Remove resolved `#47065` comment

### Test Plan

- [x]
`test_search_by_pk_with_output_fields_and_consistency_level[Strong/Session/Bounded/Eventually]`
- 4 previously failing tests now PASS
- [x] All 98 search_by_pk tests: 93 passed + 4 fixed + 1 skipped
- [x] 13 null/nullable vector related tests all PASS

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

Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
2026-02-25 16:14:46 +08:00
yanliang567 3a11ebcc88
test: Add comprehensive test coverage for nullable vector field functionality (#47847)
## Summary

Add 6 new test cases to `test_milvus_client_collection.py` covering gaps
in nullable vector field test coverage, identified after verifying fixes
for #47065 and #47197.

**Related issue**: #47846

### New Test Cases

| Test | Level | Coverage |
|------|-------|----------|
| `test_milvus_client_search_all_null_vectors` | L1 | Search on 100%
null vectors (sealed + growing) |
| `test_milvus_client_search_iterator_null_vector` | L1 | Search
iterator with all-null and mixed data |
| `test_milvus_client_query_iterator_null_vector` | L1 | Query iterator
returns all rows including null vectors |
| `test_milvus_client_upsert_null_vector_transitions` | L1 |
Non-null↔null transitions via upsert |
| `test_milvus_client_multi_vector_output_null` | L1 | Multi-vector
output with nullable field |
| `test_milvus_client_compact_with_null_vector` | L2 | Data integrity
after compaction with null vectors |

### Test Plan

- [x] All 6 tests passed against Milvus 2.6.6 (10.104.17.170)
- [x] No regressions in existing null vector tests

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

Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
2026-02-25 15:46:46 +08:00
Feilong Hou 8f282ef7fd
fix: partial update default update static field when fields name are the same (#47725)
## Summary
- After schema evolution (adding a static column that previously existed
as a dynamic field in `$meta`), partial update (`upsert` with
`partial_update=True`) fails with: `dynamic field name cannot include
the static field name`
- Root cause: during partial update, `queryPreExecute()` fetches
existing data where `$meta` still contains the old dynamic key. After
merging, `verifyDynamicFieldData()` rejects it because the key now
matches a static field name
- Fix: after the merge step in `queryPreExecute()`, strip any keys from
`$meta` JSON that conflict with current static field names

## Test plan
- [x] Added Go unit test
`TestUpsertTask_queryPreExecute_CleanUpMetaAfterSchemaEvolution`
- [x] Added Python e2e test
`test_milvus_client_partial_update_after_schema_evolution_dynamic_to_static`

issue: #47717

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

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 17:46:46 +08:00
wt 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
Feilong Hou dc8a22049e
test: add e2e test case for search order by (#47616)
Issue: #47548

 On branch feature/search-order
 Changes to be committed:
	new file:   milvus_client/test_milvus_client_search_order.py

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 17:22:42 +08:00
congqixia 1bd65fc1ce
enhance: remove deprecated lazy load code (#47590)
Related to #44452

Remove the deprecated lazy load feature which has been superseded by
warmup-related parameters. This cleanup includes:

- Remove AddFieldDataInfoForSealed from C++ segcore layer
- Remove IsLazyLoad() method and isLazyLoad field from segment
- Remove lazy load checks in proxy alterCollectionTask
- Remove DiskCache lazy load handling in search/retrieve paths
- Remove LazyLoadEnableKey constant and related helper functions
- Update mock files to reflect interface changes

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2026-02-10 14:14:44 +08:00
Feilong Hou 6c7373c34d
test: restructure timestamptz e2e cases with shared collection (#47670)
## Summary
- Restructure `TestMilvusClientTimestamptz` to use a shared collection
with non-overlapping PK ranges, reducing test setup overhead
- Add query verification to `test_partial_update` to assert timestamps
are correctly updated
- Separate test data into isolated PK slots to prevent cross-test
interference

Issue: #47668

## Test plan
- [x] Run timestamptz e2e tests to verify all cases pass
- [x] Verify partial update test now properly asserts query results

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

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 18:55:52 +08:00
wei liu 7045db3c75
fix: make snapshot creation idempotent to prevent callback retry loop [DataCoord] (#47580)
## Summary

Move snapshot existence checks to occur after acquiring exclusive locks
in CreateSnapshot and DropSnapshot. This ensures that when multiple
concurrent requests attempt to create snapshots with the same name, only
one succeeds and others immediately fail with "already exists" error,
allowing DDL callbacks to handle the result properly without entering
infinite retry loops.

## Related Issue

issue: #47101

## Changes

- **CreateSnapshot**: Move snapshot name existence check to after lock
acquisition
- **DropSnapshot**: Move snapshot existence check to after lock
acquisition
- **Test**: Fix concurrent snapshot creation test to verify "already
exists" errors by directly calling client methods to bypass
ResponseChecker framework masking

## Test Plan

-  Unit test: `test_snapshot_concurrent_create_same_name` passes
consistently
-  Verified concurrent behavior: 1 success + 4 "already exists" errors
-  No race conditions observed across multiple test runs

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

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
2026-02-09 18:51:52 +08:00
wt cd509c8bf2
fix: add WarmupKey to checkParams filter for CreateIndex idempotency (#47595)
issue: https://github.com/milvus-io/milvus/pull/39803

When creating an index, WarmupKey is removed from TypeParams before
storage (in index_service.go). However, checkParams function was not
filtering WarmupKey when comparing TypeParams for idempotency check,
causing the second CreateIndex call to fail with "at most one distinct
index is allowed per field" error.

This fix adds WarmupKey to the DeleteParams filter in checkParams
function, ensuring consistent behavior with index creation and proper
idempotency.

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
2026-02-06 11:09:50 +08:00
yanliang567 88cd109afc
test: add e2e tests for three-valued logic with nullable fields (#47582)
## Summary
Add comprehensive e2e test cases for PR #47333 which fixed three-valued
logic issues in expression evaluation with NULL values.

### Test Coverage (19 cases)

**TestMilvusClientThreeValuedLogic (17 tests)**
- **Basic IS NULL / IS NOT NULL** (2 tests)
- **NOT operator equivalences** - `NOT (IS NOT NULL) == IS NULL` (2
tests)
- **Multiple NOT operations** - double/triple NOT (2 tests)
- **Multi-field NULL combinations** - AND/OR with two nullable fields (2
tests)
- **De Morgan's law** - `NOT (A AND B)`, `NOT (A OR B)` (2 tests)
- **NULL with value comparisons** - combined NULL check and value filter
(3 tests)
- **Mixed filters** - id filter + NULL check (2 tests)
- **Search API** - search with NULL filter expressions (2 tests)

**TestMilvusClientThreeValuedLogicIssue46972 (2 tests)**
- Complex JSON expressions that triggered "False OR False = True" bug
- Uses exact reproduction case from issue #46972

### Test Design
- Uses shared collection pattern for efficiency
- Expected values calculated dynamically from stored data (not
hardcoded)
- Easy to extend with new test cases

### Verification
| Server | Result |
|--------|--------|
| With fix (master) | **19 passed** |
| Without fix (pre-PR#47333) | Multiple failures reproducing the bug |

issue: #46820, #46972

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

---------

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 10:55:51 +08:00
yanliang567 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
zhuwenxing 1257a9db1d
test: remove xfail markers for issues fixed in PR #47096 (#47555)
## Summary

Remove xfail markers for snapshot tests that are now passing after PR
#47096 fix.

Related PR: https://github.com/milvus-io/milvus/pull/47096

### Fixed Issues
- #47066: `list_snapshots()` now correctly handles empty
`collection_name` parameter
- #47067: `get_restore_snapshot_state()` now correctly returns
`start_time`
- #47068: `create_snapshot`/`drop_snapshot` now validates
`snapshot_name` properly

### Test Cases Updated
| Issue | Test Case | Change |
|-------|-----------|--------|
| #47066 | `test_snapshot_list_after_drop_collection` | Removed xfail |
| #47067 | `test_snapshot_restore_progress_tracking` | Removed xfail |
| #47068 | `test_snapshot_create_whitespace_name` | Removed xfail,
updated error code/message |
| #47068 | `test_snapshot_drop_whitespace_name` | Removed xfail, updated
error code/message |

## Test Plan

- [x] All 4 tests pass against master branch (commit f36ed550)
- [x] Verified with Milvus instance: `master-20260204-f36ed550-amd64`

```
milvus_client/test_milvus_client_snapshot.py::TestMilvusClientSnapshotCreateInvalid::test_snapshot_create_whitespace_name PASSED
milvus_client/test_milvus_client_snapshot.py::TestMilvusClientSnapshotDropInvalid::test_snapshot_drop_whitespace_name PASSED
milvus_client/test_milvus_client_snapshot.py::TestMilvusClientSnapshotBoundary::test_snapshot_restore_progress_tracking PASSED
milvus_client/test_milvus_client_snapshot.py::TestMilvusClientSnapshotNegative::test_snapshot_list_after_drop_collection PASSED
```

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-02-05 12:51:50 +08:00
zhuwenxing a80e003731
test: add snapshot API test cases (#47309)
## Summary
- Add comprehensive test cases for Milvus snapshot API functionality
- Cover snapshot create, list, describe, drop, restore operations
- Test various data types, index types, partition scenarios
- Add concurrent operation and data integrity tests
- Update pymilvus to 2.7.0rc122 for snapshot API support

## Test Coverage
- L0 smoke tests: basic snapshot lifecycle
- L1 tests: data types, partitions, indexes
- L2 tests: boundary conditions, negative cases, concurrency

## Related Issue
https://github.com/milvus-io/milvus/issues/44358

## Test plan
- [x] Run tests with `-n 6` parallel execution
- [x] Verify all tests pass (67 tests: 62 passed, 4 xfail)

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-01-28 19:41:33 +08:00
yanliang567 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
jiamingli-maker 7aa115c7b7
test: migrate advanced upsert valid cases from ORM (#47265)
/kind improvement
/assign @yanliang567 

**PR Summary**
Migrate advanced upsert valid test cases from ORM-based implementation.
- concurrent upserts on the same primary key
- multiple upsert operations
- dynamic field support
- default and None value handling
- sparse vector upsert cases

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-23 14:41:30 +08:00
jiamingli-maker cebbe1e4da
test: migrate core upsert valid cases from ORM-based cases (#47199)
/kind improvement
/assign @yanliang567 

**PR Summary**
Migrate core upsert valid test cases from ORM-based implementation.
- upsert with non-existing / existing primary keys
- upsert with auto_id enabled
- upsert with string primary key
- upsert with binary vector data
- upsert with data identical to inserted data
- upsert in specific or mismatched partitions

---------

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-23 08:57:31 +08:00
jiamingli-maker cc9fee32cb
test: migrate upsert invalid test cases from orm (#47185)
/kind improvement
/assign @yanliang567 

**PR Summary**
- Migrated upsert invalid test cases including:
  - data type mismatch
  - vector type / dimension mismatch
  - binary vector dimension mismatch
  - auto_id primary key type mismatch
  - rows using invalid type default value

---------

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-21 14:01:30 +08:00
jiamingli-maker 71e4bcf286
test: migrate insert array cases and remove migrated string field insert cases (#47173)
/kind improvement
/assign @yanliang567 

**PR Summary**

- Removed migrated ORM-based test class TestInsertString(TestcaseBase)
- Added MilvusClient-based insert array test cases:
  - `test_milvus_client_insert_array_data`
  - `test_milvus_client_insert_array_empty_field`
  - `test_milvus_client_insert_array_length_differ`
  - `test_milvus_client_insert_array_length_invalid`
  - `test_milvus_client_insert_array_type_invalid`
  - `test_milvus_client_insert_array_mixed_value`

---------

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-21 13:59:35 +08:00
yanliang567 b8938e4e82
test: add alter_collection_field description tests for PR #47057 (#47120)
## Summary
- Add E2E test cases for `alter_collection_field()` to change field
description
- Covers PR #47057 and Issue #46896
- 12 positive tests: basic functionality, pk/vector/scalar fields,
multiple alterations, empty description, special characters (unicode,
emoji, newlines, tabs)
- 4 negative tests: non-existent collection/field, empty
collection/field names

## Test plan
- [x] All 16 tests pass against Milvus server with PR #47057 merged
- [x] Verified correct `field_params` format: `{"field.description":
"..."}`

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

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:05:30 +08:00
Feilong Hou bf996cb8a0
test: create e2e case for truncate collection (#47035)
Issue: #47034 
 1. Create e2e cases for truncate collection
 2. Connect necessary sdk function to milvus client wrapper

 On branch feature/truncate
 Changes to be committed:
	modified:   base/async_milvus_client_wrapper.py
	modified:   base/client_v2_base.py
	modified:   milvus_client/test_milvus_client_collection.py
	modified:   testcases/async_milvus_client/test_collection_async.py

---------

Signed-off-by: Eric Hou <eric.hou@zilliz.com>
Co-authored-by: Eric Hou <eric.hou@zilliz.com>
2026-01-19 19:19:29 +08:00
jiamingli-maker 533e094cda
test: migrate string insert cases and refactor async insert tests (#47110)
/kind improvement
/assign @yanliang567 

**PR Summary**

- Migrate TestInsertString ORM cases to client v2:
  - `test_milvus_client_insert_string_field_is_primary`
  - `test_milvus_client_insert_multi_string_fields`
  - `test_milvus_client_insert_string_field_length_exceed`
  - `test_milvus_client_insert_string_field_space_empty`
  - `test_milvus_client_insert_string_field_is_pk_and_empty`
- Split async insert tests into
testcases/async_milvus_client/test_insert_async.py

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-19 17:03:30 +08:00
jiamingli-maker 618153ae54
test: migrate invalid insert test cases to TestMilvusClientInsertInvalid (#47098)
/kind improvement
/assign @yanliang567 

**PR Summary**
Migrate invalid insert test cases to TestMilvusClientInsertInvalid:
- `test_insert_with_invalid_field_value`
- `test_insert_over_resource_limit`
- `test_insert_type_mismatch_with_default_value_field`
- `test_insert_with_nan_value`
- `test_invalid_sparse_vector_data`

---------

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-19 11:01:30 +08:00
jiamingli-maker 53e6e6ab9c
test: migrate binary and integer overflow insert cases (#47051)
/kind improvement
/assign @yanliang567 

**PR Summary**

- This PR migrates ORM-based insert test cases to the Milvus client API,
including binary vector inserts, repeated binary vector inserts, binary
vector index creation, invalid binary scenarios, and integer overflow
validation (int8/int16/int32):
  - `test_insert_binary_partition`
  - `test_insert_binary_multi_times`
  - `test_insert_binary_create_index`
  - `test_insert_int8_overflow`
  - `test_insert_int16_overflow`
  - `test_insert_int32_overflow`
  - `test_insert_ids_binary_invalid`
  - `test_insert_with_invalid_binary_partition_name`

---------

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-15 18:51:28 +08:00
jiamingli-maker efcd39b711
test: fix insert resource-limit expectation and add async insert testcases (#47047)
/kind improvement
/assign @yanliang567 

**PR Summary**

- Fix mismatched expectations in the insert resource-limit test.
- Migrate async insert test cases from ORM-based cases, including normal
insert, large insert, invalid data, and invalid partition scenarios.

---------

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-15 18:49:34 +08:00
junjiejiangjjj 96db3b498a
test: fix highlight e2e verification issue (#47052)
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
2026-01-15 10:27:28 +08:00
Spade A b39de6391b
feat: impl StructArray -- add more tests for non-float embedding lists (#46686)
issue: https://github.com/milvus-io/milvus/issues/42148

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
- Core invariant: StructArray now accepts only fixed-dimension vector
element types (typeutil.IsFixDimVectorType) for array/struct vector
fields — i.e., dense/quantized fixed-dim vectors (FloatVector,
Float16Vector, BFloat16Vector, Int8Vector, BinaryVector) are supported
while sparse vectors remain rejected at validation
(internal/proxy/util.go → ValidateFieldsInStruct).
- Logic removed / simplified: the previous FloatVector-only special-case
was removed and replaced by a single, generic fixed-dimension check;
numerous duplicated test branches were collapsed into parameterized
fixtures (internal/core/src/common/ChunkWriterTest.cpp: GetByteWidth +
TEST_P/INSTANTIATE_TEST_SUITE_P) and ElementFilter tests were unified
under CreatePlaceholderGroupForType()/ElementFilterSealedParam,
eliminating repetitive type-specific code.
- No data loss / regression rationale (concrete code paths): existing
VECTOR_FLOAT code paths and behavior are preserved — tests explicitly
instantiate VECTOR_FLOAT cases in ChunkWriterTest and ElementFilter;
deserialization now explicitly handles empty ArrayOfVector cases and
returns the correct VectorField by elementType
(internal/storage/serde.go: deserializeArrayOfVector), and StructArray
readers were extended with byte-based branches for
float16/bfloat16/int8/binary without altering FloatVector logic
(internal/util/importutilv2/parquet/struct_field_reader.go), making all
additions additive and failing unsupported sparse vectors early at proxy
validation rather than silently.
- New capability added: full StructArray support for additional
fixed-dimension vector element types (Float16Vector, BFloat16Vector,
Int8Vector, BinaryVector) across import, serde, parquet struct readers,
test generators, and end-to-end tests (files touched include
internal/util/importutilv2/parquet/struct_field_reader.go,
internal/storage/serde.go, pkg/util/testutils/gen_data.go, various
tests), enabling non-float embedding-list and byte-based vector
workflows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
2026-01-15 10:13:27 +08:00
jiamingli-maker 3e7d9d4a12
test: refine partition insert testcases and add all-datatype case (#47000)
\kind improvement
\assign @yanliang567 

- Skip duplicated partition insert tests:
- test_insert_default_partition (covered by
test_milvus_client_insert_partition)
- test_insert_partition_not_existed (covered by
test_milvus_client_insert_not_exist_partition_name)

- Fix the docstring of
test_milvus_client_insert_not_exist_partition_name to correctly describe
insert behavior with a non-existent partition.

- Strengthen assertions for partition insert tests:

  - Verify total entity count after inserting into multiple partitions.

  - Validate returned primary key IDs when inserting with explicit IDs.

- Fix mismatched test expectations in
`test_insert_auto_id_false_same_values` by aligning the docstring with
actual behavior.
- Add test_insert_all_datatype_collection to validate insert behavior
for collections containing all supported data types using row-based
client insert.

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-14 11:53:29 +08:00
jiamingli-maker 6e2a3abc2f
test: fix insert case labels, add field-name mismatch test (#46998)
/kind improvement
/assign @yanliang567 

**PR Summary**

- Skip duplicated client insert tests already covered by existing cases
(e.g. insert after client closed, missing vector field, auto-ID
scenarios).
- Fix test docstrings to accurately describe vector field missing and
vector data type mismatch behaviors.
- Migrate a client insert test (`test_insert_field_name_not_match`).
- Fix CaseLabel tagging to keep consistent with the original ORM-based
testcases.

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-14 11:51:26 +08:00
jiamingli-maker 2a647751b1
test: add insert testcases for binary vector and none datatype (#46964)
/kind improvement
/assign @yanliang567 

**PR Summary**

- migrate Binary vector insert with schema dimension mismatch.
- migrate insert with None data.
- add `test_milvus_client_insert_binary_default` to cover BINARY_VECTOR,
which was not included in `test_milvus_client_insert_default` (covered
FLOAT_VECTOR, FLOAT16_VECTOR, BFLOAT16_VECTOR, and INT8_VECTOR

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-12 09:47:27 +08:00
jiamingli-maker 156e8280f4
test: Fix and add insert tests for auto_id (#46956)
/kind improvement

**PR Summary**

- Add auto_id parameter to test_insert_with_dataframe_values and ensure
consistent failure behavior.

- Skip duplicated auto_id list insert tests
(`test_insert_auto_id_true_list_data`,
`test_insert_auto_id_true_with_list_values`) that covered by
`test_insert_auto_id_true`.

- Fix test_insert_auto_id_true by validating generated primary keys and
their types.

- Add negative test to verify insert fails when providing primary keys
with auto_id=True.

Signed-off-by: zilliz <jiaming.li@zilliz.com>
2026-01-09 18:33:25 +08:00
zhuwenxing 4242ef9c0b
test: add empty struct array test coverage for bulk writer (#46926)
## Summary
- Remove xfail marker from
`test_import_struct_array_with_local_bulk_writer` as the related
pymilvus issue is fixed
- Add test coverage for empty struct_array in bulk writer tests

## Changes
1. Remove `@pytest.mark.xfail(reason="issue:
https://github.com/milvus-io/pymilvus/issues/3050")` marker
2. Add 10% probability to generate empty `struct_array` (`[]`) in test
data
3. Add logging for empty array count to track test coverage

## Related PRs
- pymilvus fix: https://github.com/milvus-io/pymilvus/pull/3182

## Test Plan
- [x] Tested with Milvus 2.6.8 and pymilvus fix
- [x] Both PARQUET and JSON formats pass
- [x] Empty struct arrays are correctly written, imported, and queried

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-01-09 18:05:29 +08:00
nico a43fc2de0b
test: update error message (#46801)
Signed-off-by: nico <cheng.yuan@zilliz.com>
2026-01-08 18:57:25 +08:00
marcelo-cjl 9e726e82d9
fix: improve error messages for nullable vector field operations (#46798)
issue: #46779 
related: #45993 

Return clear error when using is null/is not null filter on vector
fields
Return clear error when search by IDs with all null vectors
Fix nq mismatch when search by IDs with mixed null/valid vectors

Signed-off-by: marcelo-cjl <marcelo.chen@zilliz.com>
2026-01-08 17:45:25 +08:00
qixuan 27b106babf
test: add field case about float scalar datatype supports floating-point (#46830)
related issue: #42126

---------

Signed-off-by: qixuan <673771573@qq.com>
2026-01-08 16:39:31 +08:00
cai.zhang f46ab9cea1
fix: Align the options of WKT/WKB conversions to ensure consistent behavior (#46828)
issue: #46823

---------

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
2026-01-07 12:31:24 +08:00
yanliang567 9996e8d1ce
test: Update error msg for search by ids tests (#46792)
related issue: #46789

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2026-01-05 20:09:24 +08:00
yanliang567 7018151c7d
test: Add tests for search by ids (#46756)
related issue: #46755

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
2026-01-05 13:25:23 +08:00
yanliang567 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
nico e75ad275aa
test: update tets cases (#46699)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Pull Request Summary: Test Case Updates for API Behavior Changes

**Core Invariant**: These test case updates reflect backend API
improvements to error messaging and schema information returned by
collection operations. The changes maintain backward compatibility—no
public signatures change, and all modifications are test expectation
updates.

**Updated Error Messages for Better Diagnostics**:
- `test_add_field_feature.py`: Updated expected error when adding a
vector field without dimension specification from a generic "not support
to add vector field" to the more descriptive "vector field must have
dimension specified, field name = {field_name}: invalid parameter". This
change is non-breaking for clients that only check error codes; it
improves developer experience with clearer error context.

**Schema Information Extension**:
- `test_milvus_client_collection.py`: Added `enable_namespace: False` to
the expected `describe_collection()` output. This is a new boolean field
in the collection metadata that defaults to False, representing an
opt-in feature. Existing code querying describe_collection continues to
work; the new field is simply an additional property in the response
dictionary.

**Dynamic Error Message Construction**:
- `test_milvus_client_search_invalid.py`: Replaced hardcoded error
message with conditional logic that generates the appropriate error
based on input state (None vectors vs invalid vector data). This
prevents test brittle failure if multiple error conditions exist, and
correctly validates the API's behavior handles both "missing data" and
"malformed data" cases distinctly.

**No Regression Risk**: All changes update test expectations to match
improved backend behavior. The changes are additive (new field in
schema) or clarifying (better error messages), with no modifications to
existing response structures or behavior for valid inputs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: nico <cheng.yuan@zilliz.com>
2025-12-31 10:17:22 +08:00