13 Commits
Author SHA1 Message Date
82bb4054dd test: Add REST query order by coverage (#51460)
## What this PR does

- Adds REST v2 query coverage for orderByFields across ascending,
descending, multi-field, filtering, pagination, nullable fields, and
invalid parameters.
- Uses class-scoped REST clients and shared collection setup consistent
with the existing REST v2 test pattern.
- Verifies that omitting limit applies the REST default of 100 rows.
- Covers duplicate-key pagination behavior and exact validation error
code 1100.

## Test

Against schema-evolution-v3-latest through port-forward:

    cd tests/restful_client_v2
../python_client/.venv/bin/python -m pytest
testcases/test_query_order_by.py -v --tb=short -p no:rerunfailures
--endpoint http://127.0.0.1:19530 --token root:Milvus

Result: 16 passed, 16 warnings in 40.87s.

---------

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-07-20 18:44:43 +08:00
c322c84c22 test: cover add-field default values on growing segments (#51303)
## What this PR does

- Remove the `xfail` marker from the existing drop-and-readd
analyzer-field regression for #50484.
- Add L1 E2E coverage for the live QueryNode growing-segment reopen path
when an `enable_match` VARCHAR field with `default_value` is added to
loaded growing data.
- Verify the default value is immediately searchable on pre-existing
unflushed rows, eventually searchable on a subsequent defaulted insert
after the growing text index catches up, and remains searchable after
flush/reload.

Related fix: #51201

issue: #50484

## Scope note

This PR validates the live reopen path:

```text
loaded collection
-> insert rows that stay in a QueryNode growing segment
-> add an `enable_match` VARCHAR field with `default_value`
-> query triggers LazyCheckSchema/Reopen
-> default values for pre-existing growing rows are indexed and searchable immediately
```

It does not cover the QueryNode recovery / LoadGrowing path. That path
requires forcing a QueryNode restart, replacement, or channel rewatch
while the data is still growing: the new QueryNode can create the
segment with the latest schema and then load old binlogs written before
AddField. Since the segment schema is already current in that path,
LazyCheckSchema/Reopen is not the mechanism being tested here. Recovery
coverage should be handled by a focused stability test.

## Test results

-
`test_milvus_client_add_match_field_with_default_value_on_growing_data`:
3/3 passed
- `test_drop_then_add_same_name_analyzer_field`: passed
- Ruff lint and format checks: passed
- `git diff --check`: passed

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-13 20:12:37 +08:00
Li YiyangandGitHub f8130ad8d9 test: add REST e2e coverage for regex and array updates (#51189)
## Summary

- Add REST v2 e2e coverage for partial update `ARRAY_APPEND` and
`ARRAY_REMOVE` field operations on Array fields.
- Add REST v2 e2e coverage for regex filters across query, search,
delete, JSON paths, Array<Varchar> elements, nullable VarChar fields,
negation, boolean expressions, and invalid expressions.

## Test Plan

- [x] `PYTHONPYCACHEPREFIX=/private/tmp/milvus_pycache
/Users/yiyang.li/gitup/milvus/tests/python_client/.venv/bin/python -m
py_compile
tests/restful_client_v2/testcases/test_partial_update_array_op.py
tests/restful_client_v2/testcases/test_regex_filter.py`
- [x] `git diff --cached --check`

---------

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
2026-07-10 17:48:34 +08:00
Li YiyangandGitHub d8d823e782 test: add schema evolution e2e coverage (#50826)
## What
- Add drop field e2e coverage for MilvusClient.
- Add function field e2e coverage.
- Refine schema evolution e2e coverage.
- Bump pymilvus test dependency to 3.1.0rc49.

## Test
- Not run in this turn; PR contains Python e2e test coverage changes.

---------

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
2026-06-30 11:02:31 +08:00
Li YiyangandGitHub e7010620bc test: Add regex filter e2e tests (#49984)
## Summary

Add Python client E2E coverage for regex filter expressions (`=~` and
`!~`).

Coverage includes:
- Basic regex semantics, negation, Unicode, empty values, invalid
patterns, and unsupported RE2 constructs
- VarChar, JSON, ARRAY element, NULL, and unsupported field type
behavior
- Query, search, hybrid search, boolean combinations, limit/offset,
delete, and concurrency correctness
- Scalar index paths including NGRAM, INVERTED, STL_SORT, BITMAP, Trie,
sealed/growing segments, and reload
- Template expression parameters for regex filters, including invalid
regex/type mismatch/injection safety

Related issue: #49899

## Test Plan

- [x] `./tests/python_client/.venv/bin/python -m ruff check
tests/python_client/milvus_client/test_milvus_client_regex_filter.py`
- [x] `./tests/python_client/.venv/bin/python -m py_compile
tests/python_client/milvus_client/test_milvus_client_regex_filter.py`
- [x] `./.venv/bin/pytest
milvus_client/test_milvus_client_regex_filter.py --uri
http://localhost:19530 --tag L1 -n 4 --dist loadscope -x -v -s
--tb=short` (`68 passed, 544 warnings in 131.52s`)

---------

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
2026-05-29 14:02:14 +08:00
8013b26bb2 test: add sealed segment path tests for ARRAY_APPEND/ARRAY_REMOVE (#49770)
## Summary
- Add 3 test cases (Module 4) to verify ARRAY_APPEND/ARRAY_REMOVE work
correctly on sealed segments after flush + release + load
- Validate via both `output_fields` query and `array_contains` predicate
expressions
- Covers Int64 append/remove sealed path and VarChar append+remove
sealed path
- This addresses the review feedback from @yanliang567 on #49689 about
missing sealed/index path coverage

## Test plan
- [x] `test_array_partial_op_append_sealed_path` — append → flush →
release → load → array_contains verify
- [x] `test_array_partial_op_remove_sealed_path` — remove → flush →
release → load → array_contains verify (removed values not found)
- [x] `test_array_partial_op_append_remove_varchar_sealed_path` — append
→ flush/reload → remove → flush/reload → array_contains verify (VarChar
type)
- [x] Verified on master, 2.6, and 3.0 environments — all 3 passed

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

---------

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 12:56:27 +08:00
fa5e5632ab test: add partial update array ops tests for field_ops (ARRAY_APPEND/ARRAY_REMOVE) (#49689)
## Summary
- Add comprehensive test cases for partial update array ops
(ARRAY_APPEND / ARRAY_REMOVE) via `field_ops` parameter in MilvusClient
upsert API
- Cover all supported element types (BOOL, INT8/16/32/64, FLOAT, DOUBLE,
VARCHAR) for both append and remove operations
- Include error scenarios: non-array field, PK field, unknown field,
type mismatch, missing field data, capacity exceeded, max_length
exceeded
- Add atomicity tests: parse-stage (mixed valid + invalid field type)
and execution-stage (capacity exceeded, max_length exceeded) rollback
verification
- Cover boundary scenarios: empty array append, remove
all/single/duplicate/non-existent elements, nullable fields, null
payload rows, exact capacity fill

issue: #49241

## Test Plan
- 36 test cases total, all verified locally with 8-worker parallel
execution (56s, 36 passed)
- Module 1 (14 cases): typed append/remove parameterized + multi-field
- Module 2 (9 cases): error handling + atomicity
- Module 3 (14 cases): boundary scenarios

---------

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:14:10 +08:00
b650ea62d7 test: add high-cardinality GROUP BY aggregation test (#49278)
## Summary
- Add E2E test for high-cardinality GROUP BY aggregation (issue #47569)
- Tests GROUP BY with 2500 unique group keys (above the original 1792
HashTable slot limit)
- Covers both growing segment (before flush) and sealed segment (after
flush)
- Verifies group count, uniqueness, and aggregation correctness against
pandas ground truth
- Lightweight: 3000 rows, ~7 seconds runtime

issue: #47569

## Test plan
- [x] `pytest
testcases/test_query_aggregation.py::TestQueryAggregationIndependentV2::test_high_cardinality_group_by`
— passed in 6.59s

🤖 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-04-23 17:55:44 +08:00
b8771ecad7 test: add extra test cases for query ORDER BY coverage (#48868)
## Summary
- Add 7 new test cases for query ORDER BY based on code review feedback
and search ORDER BY parity
- OB-006: parametrize limit values (1, 5, 50, 100, 500) replacing single
small_limit test
- OB-057: ORDER BY on GROUP BY column with aggregation (positive case
for OB-052)
- OB-058: offset = total - 1, last-page edge case
- OB-059: float field with duplicate values, PK tie-breaking
verification
- OB-060: ORDER BY on empty collection returns empty result
- OB-061: all output_fields present in results with ORDER BY
- OB-062: malformed dict missing 'field' key error handling

## Test plan
- [x] All 77 test cases passed locally against Milvus
master-20260408-4957592
- [ ] CI E2E tests pass

🤖 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-04-09 17:09:41 +08:00
Li YiyangandGitHub 591867d87b test: add E2E tests for query ORDER BY feature (#48729)
## Summary
- Add 58 E2E test cases for the query ORDER BY feature
([#48125](https://github.com/milvus-io/milvus/pull/48125),
[#48298](https://github.com/milvus-io/milvus/pull/48298))
- Covers single/multi-field sorting, all scalar types (Int8/16/32/64,
Float, Double, VarChar, Bool), nullable fields with NULLS FIRST/LAST
semantics, explicit `nulls_first`/`nulls_last` override syntax,
pagination, partition support, cross-segment merge sort (sealed +
growing), indexed vs non-indexed fields, upsert deduplication, and error
handling for unsupported types
- Shared Collection A with 3200 rows across 3 sealed + 1 growing
segments, custom partition (odd/even split), INVERTED index on
int32_field

## Related Issues
#41675

## Test plan
- [x] All 58 test cases pass locally against `master-20260401-5a44a9e`
- [x] L0 (4 cases): basic asc/desc, multi-field sort, filter + order_by
- [x] L1 (31 cases): parameter format variants, data type coverage,
pagination, nullable handling, nulls_first/nulls_last override, output
fields, partition
- [x] L2 (16 cases): cross-segment sort, sealed+growing, indexed vs
non-indexed, upsert, error handling (vector/JSON/array/invalid
direction/missing limit), edge cases (identical values, 3-field sort,
single row, stability)

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

Signed-off-by: lyyyuna <yiyang.li@zilliz.com>
2026-04-08 10:51:37 +08:00
371b35efac test: Migrate insert test cases from v1 ORM to v2 MilvusClient (#48231)
## Summary
- Migrate 25 insert test cases from v1 ORM style
(`testcases/test_insert.py`) to v2 MilvusClient style
(`milvus_client/test_milvus_client_insert.py`)
- Delete migrated v1 test cases, retain
DataFrame/column-based/async-specific tests that have no v2 equivalent
- New v2 test `test_insert_with_pk_varchar_auto_id_true`: validates
varchar PK with auto_id=True, includes query verification for
auto-generated IDs

## Related Issues
#48048

## Test plan
- [x] Verified `test_insert_with_pk_varchar_auto_id_true` passes against
local Milvus (port 19531)
- [x] Cross-checked all 58 v1 cases: 25 migrated, 33 skipped
(DataFrame/column-based/v1 async), 0 remaining

There are a lot of insert test cases remain skipped, you can view
[test_insert.py Migration
Checklist](https://zilliverse.feishu.cn/docx/YAsedYP1go9qlexDyi0cgKwgnIj)
for reason.

🤖 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-30 10:13:31 +08:00
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
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