Files
zhuwenxing 3e7b80b5f0 test: avoid duplicate recovery continuation workloads (#54740)
The post-chaos collection verification stage can exceed its 60-minute
timeout because each concurrent worker creates a dedicated recovery
continuation collection. With five concurrent workers and one
single-request workload, verification includes five ordinary collections
and six recovery collections. At three workers and at least 16 minutes
per case, this requires at least 64 minutes before other overhead.

Keep recovery collection creation in the single-request workload and
remove duplicate creation from concurrent workers. The concurrent
workload still resumes existing recovery collections and verifies their
retained input journals. For this job configuration, post-chaos
verification is reduced from 11 cases to 6; recovery continuation
coverage uses one collection instead of six.

Validation:
- Ruff lint and formatting checks passed.
- Python compilation passed.
- Isolated initializer checks with mocked checker constructors passed:
five concurrent workers plus one single-request worker create one
recovery checker; existing recovery collections resume exclusively;
ordinary collections create no recovery checker.
- Jenkins/E2E was not rerun. Actual runtime improvement remains
unverified.

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2026-10-28 15:29:59 +08:00
..

Chaos Tests

Goal

Chaos tests are designed to check the reliability of Milvus.

For instance, if one pod is killed:

  • verify that it restarts automatically
  • verify that the related operation fails, while the other operations keep working successfully during the absence of the pod
  • verify that all the operations work successfully after the pod back to running state
  • verify that no data lost

Prerequisite

Chaos tests run in pytest framework, same as e2e tests.

Please refer to Run E2E Tests

Flow Chart

Chaos Test Flow Chart

Test Scenarios

Milvus in cluster mode

pod kill

Kill pod every 5s

pod network partition

Two direction(to and from) network isolation between a pod and the rest of the pods

pod failure

Set the pod(querynode, indexnode and datanode)as multiple replicas, make one of them failure, and test milvus's functionality

pod memory stress

Limit the memory resource of pod and generate plenty of stresses over a group of pods

Milvus in standalone mode

  1. standalone pod is killed

  2. minio pod is killed

How it works

  • Test scenarios are designed by different chaos objects
  • Every chaos object is defined in one yaml file locates in folder chaos_objects
  • Every chaos yaml file specified by ALL_CHAOS_YAMLS in constants.py would be parsed as a parameter and be passed into test_chaos.py
  • All expectations of every scenario are defined in testcases.yaml locates in folder chaos_objects
  • Chaos Mesh is used to inject chaos into Milvus in test_chaos.py

Run

Manually

Run a single test scenario manually(take query node pod is killed as instance):

  1. update ALL_CHAOS_YAMLS = 'chaos_querynode_podkill.yaml' in constants.py

  2. run the commands below:

    cd /milvus/tests/python_client/chaos
    
    pytest test_chaos.py --host ${Milvus_IP} -v
    

Run multiple test scenario in a category manually(take network partition chaos for all pods as instance):

  1. update ALL_CHAOS_YAMLS = 'chaos_*_network_partition.yaml' in constants.py

  2. run the commands below:

    cd /milvus/tests/python_client/chaos
    
    pytest test_chaos.py --host ${Milvus_IP} -v
    

Automation Scripts

Run test scenario automatically:

  1. update chaos type and pod in chaos_test.sh
  2. run the commands below:
    cd /milvus/tests/python_client/chaos
    # in this step, script will install milvus with replicas_num and run testcase
    bash chaos_test.sh ${pod} ${chaos_type} ${chaos_task} ${replicas_num}
    # example: bash chaos_test.sh querynode pod_kill chaos-test 2
    

Nightly

still in planning

Todo

  • network attack
  • clock skew
  • IO injection

How to contribute

  • Get familiar with chaos engineering and Chaos Mesh
  • Design chaos scenarios, preferring to pick from todo list
  • Generate yaml file for your chaos scenarios. You can create a chaos experiment in chaos-dashboard, then download the yaml file of it.
  • Add yaml file to chaos_objects dir and rename it as chaos_${component_name}_${chaos_type}.yaml. Make sure kubectl apply -f ${your_chaos_yaml_file} can take effect
  • Add testcase in testcases.yaml. You should figure out the expectation of milvus during the chaos
  • Run your added testcase according to Manually above and check whether it as your expectation

Continuing writes across recovery

RecoveryContinuationChecker runs with the existing single-request and concurrent chaos workloads without additional options. It alternates small and large payloads in an independent collection, then checks continued writes and data integrity after flush and reload. Fault injection uses the existing scenario orchestration.

Preserve /tmp/ci_logs/recovery_continuation/ across test phases: post-chaos checks use these retained write inputs to verify the original data.