2021-12-28 16:01:50 +08:00
|
|
|
name: Cluster N node Chaos Test
|
2021-10-16 22:12:40 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-06-10 19:36:07 +08:00
|
|
|
inputs:
|
|
|
|
image_tag:
|
|
|
|
description: The image tag to use for the chaos test
|
|
|
|
required: true
|
|
|
|
default: 'master-latest'
|
|
|
|
image_repo:
|
|
|
|
description: The image repo to use for the chaos test
|
|
|
|
required: true
|
2022-06-30 15:20:22 +08:00
|
|
|
default: 'milvusdb/milvus'
|
2021-10-21 20:03:35 +08:00
|
|
|
schedule:
|
|
|
|
- cron: "30 19 * * *"
|
2021-10-16 22:12:40 +08:00
|
|
|
jobs:
|
|
|
|
|
2021-12-28 16:01:50 +08:00
|
|
|
test-cluster-n-node-chaos:
|
2021-10-16 22:12:40 +08:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
2021-11-18 22:35:20 +08:00
|
|
|
timeout-minutes: 40
|
2021-10-16 22:12:40 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-12-28 16:01:50 +08:00
|
|
|
chaos_type: [pod_failure, pod_kill]
|
2021-10-30 21:27:54 +08:00
|
|
|
pod: [querynode, datanode, indexnode, proxy]
|
2021-10-16 22:12:40 +08:00
|
|
|
|
|
|
|
steps:
|
2021-12-08 16:43:30 +08:00
|
|
|
- name: Set env param
|
2022-06-11 15:10:08 +08:00
|
|
|
env:
|
|
|
|
DEFAULT_IMAGE_TAG: master-latest
|
2022-06-30 15:20:22 +08:00
|
|
|
DEFAULT_IMAGE_REPO: milvusdb/milvus
|
2021-12-08 16:43:30 +08:00
|
|
|
run: |
|
2021-12-28 16:01:50 +08:00
|
|
|
chaos_type=${{ matrix.chaos_type }}
|
|
|
|
release="test"-${{ matrix.pod }}-${chaos_type/_/-}
|
|
|
|
echo "RELEASE=$release" >> $GITHUB_ENV
|
2022-06-10 19:36:07 +08:00
|
|
|
echo "IMAGE_REPO=${{ github.event.inputs.image_repo || env.DEFAULT_IMAGE_REPO}}" >> $GITHUB_ENV
|
|
|
|
echo "IMAGE_TAG=${{ github.event.inputs.image_tag || env.DEFAULT_IMAGE_TAG}}" >> $GITHUB_ENV
|
2021-10-16 22:12:40 +08:00
|
|
|
- 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
|
|
|
|
|
|
|
|
- name: Install dependency
|
|
|
|
uses: nick-invision/retry@v2
|
|
|
|
with:
|
|
|
|
timeout_minutes: 5
|
|
|
|
max_attempts: 3
|
|
|
|
retry_on: error
|
|
|
|
shell: bash
|
|
|
|
command: |
|
|
|
|
pip install -r tests/python_client/requirements.txt
|
|
|
|
|
|
|
|
- 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-12-28 16:01:50 +08:00
|
|
|
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=chaos-testing --version v2.0.3 --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock
|
2021-10-16 22:12:40 +08:00
|
|
|
sleep 60s
|
|
|
|
kubectl get po -n chaos-testing
|
|
|
|
|
|
|
|
- name: Deploy Milvus
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos
|
|
|
|
run: |
|
2021-12-24 17:01:00 +08:00
|
|
|
echo "latest tag:"
|
2022-06-30 15:20:22 +08:00
|
|
|
bash ../../../scripts/docker_image_find_tag.sh -n milvusdb/milvus -t master-latest -f master- -F -L -q
|
2021-10-30 21:27:54 +08:00
|
|
|
declare -A pod_map=( ["querynode"]="queryNode" ["indexnode"]="indexNode" ["datanode"]="dataNode" ["proxy"]="proxy")
|
2021-10-16 22:12:40 +08:00
|
|
|
helm repo add milvus https://milvus-io.github.io/milvus-helm
|
|
|
|
helm repo update
|
2022-06-10 19:36:07 +08:00
|
|
|
helm install --wait --timeout 720s ${{ env.RELEASE }} milvus/milvus --set image.all.repository=${{ env.IMAGE_REPO }} --set image.all.tag=${{ env.IMAGE_TAG }} --set ${pod_map[${{ matrix.pod }}]}.replicas=2 -f cluster-values.yaml -n=chaos-testing
|
2021-10-16 22:12:40 +08:00
|
|
|
kubectl get pods -n chaos-testing
|
|
|
|
sleep 20s
|
|
|
|
kubectl get pods -n chaos-testing
|
2021-12-08 16:43:30 +08:00
|
|
|
kubectl port-forward service/${{ env.RELEASE }}-milvus 19530 -n chaos-testing >/dev/null 2>&1 &
|
2021-10-16 22:12:40 +08:00
|
|
|
sleep 20s
|
|
|
|
# check whether port-forward success
|
|
|
|
nc -vz 127.0.0.1 19530
|
|
|
|
# check whether milvus server is healthy
|
2021-12-24 17:01:00 +08:00
|
|
|
pytest -s -v ../testcases/test_e2e.py --host 127.0.0.1 --log-cli-level=INFO --capture=no
|
|
|
|
python scripts/hello_milvus.py --host 127.0.0.1
|
2021-11-30 14:12:23 +08:00
|
|
|
|
2021-10-16 22:12:40 +08:00
|
|
|
- name: Chaos Test
|
|
|
|
timeout-minutes: 15
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos
|
|
|
|
run: |
|
|
|
|
# replace chaos object
|
2021-12-28 16:01:50 +08:00
|
|
|
sed -i "s/TESTS_CONFIG_LOCATION =.*/TESTS_CONFIG_LOCATION = \'chaos_objects\/${{ matrix.chaos_type }}\/'/g" constants.py
|
|
|
|
sed -i "s/ALL_CHAOS_YAMLS =.*/ALL_CHAOS_YAMLS = \'chaos_${{ matrix.pod }}_${{ matrix.chaos_type }}.yaml\'/g" constants.py
|
2021-10-19 21:08:44 +08:00
|
|
|
sed -i "s/CHAOS_DURATION =.*/CHAOS_DURATION = 80/g" constants.py
|
2022-01-04 09:03:20 +08:00
|
|
|
sed -i "s/RELEASE_NAME =.*/RELEASE_NAME = \'${{ env.RELEASE }}\'/g" constants.py
|
2021-10-16 22:12:40 +08:00
|
|
|
cat constants.py
|
2022-01-24 18:59:41 +08:00
|
|
|
timeout 14m pytest -s -v test_chaos.py --host 127.0.0.1 --log-cli-level=INFO --capture=no || echo "chaos test failed"
|
|
|
|
|
|
|
|
- name: Result Analysis
|
|
|
|
timeout-minutes: 15
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos/reports
|
|
|
|
run: |
|
|
|
|
echo "result analysis"
|
|
|
|
cat ${{ env.RELEASE }}.log || echo "no log file"
|
2021-10-16 22:12:40 +08:00
|
|
|
|
|
|
|
- name: Milvus E2E Test
|
2021-12-24 17:01:00 +08:00
|
|
|
timeout-minutes: 10
|
2021-10-16 22:12:40 +08:00
|
|
|
if: ${{ always() }}
|
|
|
|
shell: bash
|
2021-12-13 13:33:16 +08:00
|
|
|
working-directory: tests/python_client
|
2021-10-16 22:12:40 +08:00
|
|
|
run: |
|
|
|
|
kubectl get pod -n chaos-testing
|
2021-12-08 16:43:30 +08:00
|
|
|
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/instance=${{ env.RELEASE }} -n chaos-testing --timeout=360s
|
|
|
|
kubectl wait --for=condition=Ready pod -l release=${{ env.RELEASE }} -n chaos-testing --timeout=360s
|
2021-12-10 21:21:30 +08:00
|
|
|
kubectl get pod -n chaos-testing
|
|
|
|
ps aux|grep forward|grep -v grep|awk '{print $2}'|xargs kill -9
|
|
|
|
kubectl port-forward service/${{ env.RELEASE }}-milvus 19530 -n chaos-testing >/dev/null 2>&1 &
|
|
|
|
|
|
|
|
sleep 20s
|
|
|
|
nc -vz 127.0.0.1 19530
|
|
|
|
|
|
|
|
pytest -s -v testcases/test_e2e.py --host 127.0.0.1 --log-cli-level=INFO --capture=no
|
|
|
|
python chaos/scripts/hello_milvus.py --host 127.0.0.1
|
2021-10-16 22:12:40 +08:00
|
|
|
|
2021-12-24 17:01: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 ${{ env.RELEASE }} k8s_logs/chaos-test
|
|
|
|
|
2021-10-16 22:12:40 +08:00
|
|
|
- name: Data Consist Test
|
|
|
|
timeout-minutes: 5
|
|
|
|
if: ${{ always() }}
|
|
|
|
shell: bash
|
|
|
|
working-directory: tests/python_client/chaos
|
|
|
|
run: |
|
2021-11-29 21:07:53 +08:00
|
|
|
pytest -s -v test_chaos_data_consist.py --host 127.0.0.1 --log-cli-level=INFO || echo "data consist chaos test failed"
|
2021-10-16 22:12:40 +08:00
|
|
|
|
|
|
|
- name: Milvus E2E Test
|
|
|
|
timeout-minutes: 5
|
|
|
|
if: ${{ always() }}
|
|
|
|
shell: bash
|
2021-12-14 16:26:22 +08:00
|
|
|
working-directory: tests/python_client
|
2021-10-16 22:12:40 +08:00
|
|
|
run: |
|
|
|
|
kubectl get pod -n chaos-testing
|
2021-12-08 16:43:30 +08:00
|
|
|
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/instance=${{ env.RELEASE }} -n chaos-testing --timeout=360s
|
|
|
|
kubectl wait --for=condition=Ready pod -l release=${{ env.RELEASE }} -n chaos-testing --timeout=360s
|
2021-12-10 21:21:30 +08:00
|
|
|
kubectl get pod -n chaos-testing
|
|
|
|
ps aux|grep forward|grep -v grep|awk '{print $2}'|xargs kill -9
|
|
|
|
kubectl port-forward service/${{ env.RELEASE }}-milvus 19530 -n chaos-testing >/dev/null 2>&1 &
|
|
|
|
|
|
|
|
sleep 20s
|
|
|
|
nc -vz 127.0.0.1 19530
|
|
|
|
|
|
|
|
pytest -s -v testcases/test_e2e.py --host 127.0.0.1 --log-cli-level=INFO --capture=no
|
|
|
|
python chaos/scripts/hello_milvus.py --host 127.0.0.1
|
2021-10-16 22:12:40 +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
|
2021-12-24 17:01:00 +08:00
|
|
|
bash ../../scripts/export_log_k8s.sh chaos-testing ${{ env.RELEASE }} k8s_logs/data-consist-test
|
2021-10-16 22:12:40 +08:00
|
|
|
bash ../../scripts/export_log_k8s.sh chaos-testing chaos-daemon
|
|
|
|
|
|
|
|
- name: Upload logs
|
2022-06-14 09:10:09 +08:00
|
|
|
if: ${{ ! success() }}
|
2021-10-16 22:12:40 +08:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-12-28 16:01:50 +08:00
|
|
|
name: logs-${{ matrix.pod }}-${{ matrix.chaos_type }}
|
2021-10-16 22:12:40 +08:00
|
|
|
path: tests/python_client/chaos/k8s_logs
|