2021-09-28 17:06:04 +08:00
|
|
|
name: Network Partition Chaos Test
|
2021-09-22 17:37:53 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
test-network-partition-chaos:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
2021-10-12 19:54:35 +08:00
|
|
|
timeout-minutes: 30
|
2021-09-22 17:37:53 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-09-23 12:03:54 +08:00
|
|
|
pod: [datacoord, datanode, indexcoord, indexnode, proxy, pulsar, querycoord, querynode, rootcoord, etcd, minio]
|
2021-09-22 17:37:53 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Creating kind cluster
|
|
|
|
uses: helm/kind-action@v1.2.0
|
|
|
|
- name: Print cluster information
|
|
|
|
run: |
|
|
|
|
kubectl config view
|
|
|
|
kubectl cluster-info
|
|
|
|
kubectl get nodes
|
|
|
|
kubectl get pods -n kube-system
|
|
|
|
helm version
|
|
|
|
kubectl version
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.8
|
2021-09-29 20:06:00 +08:00
|
|
|
|
|
|
|
- name: Install dependency
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos
|
|
|
|
run: |
|
|
|
|
pip install -r ../requirements.txt
|
|
|
|
pip install --upgrade protobuf
|
|
|
|
|
2021-09-22 17:37:53 +08:00
|
|
|
- name: Deploy Chaos Mesh
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
helm repo add chaos-mesh https://charts.chaos-mesh.org
|
|
|
|
helm search repo chaos-mesh
|
|
|
|
kubectl create ns chaos-testing
|
2021-09-23 12:03:54 +08:00
|
|
|
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-testing --version v2.0.1 --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock
|
2021-10-01 20:51:51 +08:00
|
|
|
# wait for all pod running
|
2021-09-22 17:37:53 +08:00
|
|
|
sleep 60s
|
|
|
|
kubectl get po -n chaos-testing
|
2021-09-23 12:03:54 +08:00
|
|
|
|
2021-09-22 17:37:53 +08:00
|
|
|
- name: Deploy Milvus
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
helm repo add milvus https://milvus-io.github.io/milvus-helm
|
|
|
|
helm repo update
|
2021-10-01 20:51:51 +08:00
|
|
|
# install milvus with latest image
|
2022-06-30 15:20:22 +08:00
|
|
|
helm install --wait --timeout 360s chaos-testing milvus/milvus --set cluster.enabled=true --set image.all.repository=milvusdb/milvus --set image.all.tag=master-latest -n=chaos-testing
|
2021-09-22 17:37:53 +08:00
|
|
|
kubectl get pods -n chaos-testing
|
2021-10-12 16:48:35 +08:00
|
|
|
sleep 20s
|
2021-09-22 17:37:53 +08:00
|
|
|
kubectl get pods -n chaos-testing
|
|
|
|
kubectl port-forward service/chaos-testing-milvus 19530 -n chaos-testing >/dev/null 2>&1 &
|
|
|
|
sleep 20s
|
2021-10-01 20:51:51 +08:00
|
|
|
# check whether port-forward success
|
2021-09-22 17:37:53 +08:00
|
|
|
nc -vz 127.0.0.1 19530
|
|
|
|
- name: Chaos Test
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos
|
|
|
|
run: |
|
2021-10-01 20:51:51 +08:00
|
|
|
# replace chaos object
|
2021-11-06 20:44:55 +08:00
|
|
|
sed -i "s/TESTS_CONFIG_LOCATION =.*/TESTS_CONFIG_LOCATION = \'chaos_objects\/network_partition\/'/g" constants.py
|
2021-09-22 17:37:53 +08:00
|
|
|
sed -i "s/ALL_CHAOS_YAMLS =.*/ALL_CHAOS_YAMLS = \'chaos_${{ matrix.pod }}_network_partition.yaml\'/g" constants.py
|
|
|
|
cat constants.py
|
2021-11-06 20:44:55 +08:00
|
|
|
pytest -s -v test_chaos.py --host 127.0.0.1
|
2021-09-29 20:06:00 +08:00
|
|
|
|
|
|
|
- name: Export logs
|
|
|
|
if: ${{ always() }}
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos
|
|
|
|
run: |
|
|
|
|
#in this step, verify whether pod has been killed by pod's age
|
|
|
|
kubectl get po -n chaos-testing
|
|
|
|
# export k8s log for chaos mesh and milvus
|
|
|
|
bash ../../scripts/export_log_k8s.sh chaos-testing chaos-testing
|
|
|
|
bash ../../scripts/export_log_k8s.sh chaos-testing chaos-daemon
|
|
|
|
|
|
|
|
- name: Upload logs
|
|
|
|
if: ${{ always() }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: logs-${{ matrix.pod }}
|
|
|
|
path: tests/python_client/chaos/k8s_logs
|