6 Commits
Author SHA1 Message Date
zhuwenxingandGitHub 43264fc57a test: use container kill for CDC failover scenarios (#51479)
## What changed

- Replace Pod deletion with Chaos Mesh `container-kill` in CDC
force-promote and source-down failover tests.
- Kill every regular container in matching Pods while preserving the Pod
objects.
- Verify that Pod UIDs remain unchanged and each container's restart
count increases.
- Clean up the generated `PodChaos` resources after fault injection.

## Why

Deleting Pods changes their identity and tests Pod recreation rather
than container-level recovery. These scenarios need to verify CDC
failover behavior when containers restart inside the existing Pods.

## Impact

CDC failover tests now exercise container failures while explicitly
validating that Kubernetes does not recreate the affected Pods.

## Validation

- `ruff check` passed for all modified files.
- `ruff format --check` passed for all modified files.
- Python compilation passed for all modified files.
- Full CDC E2E was not run locally because it requires a Kubernetes
environment with Chaos Mesh.

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-07-17 11:08:41 +08:00
zhuwenxingandGitHub a95a54e875 test: add REST import 2PC coverage (#50462)
## What type of PR is this?

/kind test

## What this PR does / why we need it:

Adds RESTful import 2PC coverage for Milvus import lifecycle and
CDC-focused scenarios.

This PR adds:
- REST import job helpers for `/describe`, `/commit`, `/abort`, and
state polling
- pytest options for secondary CDC endpoint/object storage/topology
parameters
- a new REST test suite for import 2PC lifecycle, visibility,
commit/abort, delete semantics, TTL, compaction, formats, data types,
indexes, partitions, DML interleaving, CDC, and fault-tolerance gates
- xfail regression coverage for known issues:
  - #50458 REST import commit/abort authorization gap
  - #50459 NaN/Inf FloatVector import/query behavior
  - #50460 REST `options.auto_commit=null` validation gap

## Which issue(s) this PR fixes:

N/A

## Special notes for your reviewer:

The CDC cases require passing secondary cluster REST/MinIO options and
topology arguments. Without those options, CDC-specific cases skip with
an explicit environment precondition message.

The manual compaction-after-commit case is marked non-strict xfail
because compaction may remain `Executing` on current import 2PC test
builds.

## Test result:

```text
python -m py_compile tests/restful_client_v2/conftest.py tests/restful_client_v2/api/milvus.py tests/restful_client_v2/testcases/test_import_2pc_operation.py
ruff check tests/restful_client_v2/api/milvus.py tests/restful_client_v2/conftest.py tests/restful_client_v2/testcases/test_import_2pc_operation.py
python -m pytest --collect-only -q testcases/test_import_2pc_operation.py
141 tests collected in 2.14s
```

---------

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-06-18 19:00:24 +08:00
yihao.daiandGitHub a69e9368b6 test: Fix CDC force-promote cleanup before final diff (#50326)
## Summary

issue: #50320

Clean downstream-only collections created during CDC force-promote
verification before restoring the topology back to `upstream ->
downstream`.

The affected tests create `*_after` collections while downstream is
force-promoted primary. If teardown restores `A -> B` first, downstream
becomes a replica again and `drop_collection` is rejected, leaving
`test_fp_*_after` collections that fail the final upstream/downstream
diff.

## Changes

- Add targeted cleanup for downstream-only force-promote verification
collections.
- Remove those collections from the generic cleanup list after the
targeted cleanup attempt.
- Add a focused unit test for the cleanup helper behavior.

## Test Plan

- [x] `PYTHONPATH=tests/python_client conda run -n milvus2 python -m
pytest -c /tmp/empty-pytest.ini
--confcutdir=tests/python_client/cdc/testcases
tests/python_client/cdc/testcases/test_force_promote_cleanup.py -q`
- [x] `conda run -n milvus2 python -m py_compile
tests/python_client/cdc/testcases/test_force_promote.py
tests/python_client/cdc/testcases/test_force_promote_cleanup.py`
- [x] `git diff --check`
- [ ] `make static-check` could not complete locally because the CGo
core artifacts in this workspace do not match the latest master headers.
It first failed without `milvus_core.pc`; with
`PKG_CONFIG_PATH=/Users/yihao.dai/workspace/milvus/internal/core/output/lib/pkgconfig`,
it failed at `internal/util/initcore` with missing
`C.CArrowReaderConfig` / `C.InitArrowReaderConfig`.

Signed-off-by: Yihao Dai <yihao.dai@zilliz.com>
2026-06-11 06:26:20 +08:00
yihao.daiandGitHub ae6bc61b4a test:(cdc) add force-promote failover scenario tests (#49423)
## Summary
- add `kubectl_helper` fixture in `tests/python_client/cdc/conftest.py`
for pod delete / readiness wait during failover tests
- add `tests/python_client/cdc/testcases/test_force_promote.py` with
force-promote failover scenarios:
  - basic promote after source kill
  - target restart during promote
  - source restart during promote
  - incomplete DDL during promote
  - network partition then promote
  - endurance loop test behind `RUN_ENDURANCE`
- include teardown restore and cleanup logic to return topology to a
known state after each case

## Test plan
- [x] `ruff` formatting/lint fixes included in commits
- [ ] `make static-check` (skipped per request)

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

---------

Signed-off-by: Yihao Dai <yihao.dai@zilliz.com>
2026-05-17 15:14:28 +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