apisix/.github/workflows/chaos.yml
dependabot[bot] a163bd6c95
chore(deps): bump actions/cache from 2.1.6 to 2.1.7 (#5577)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 17:30:14 +08:00

91 lines
3.0 KiB
YAML

name: Chaos Test
on:
pull_request:
branches: [master, 'release/**']
paths-ignore:
- 'docs/**'
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
chaos-test:
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: recursive
- name: Setup go
uses: actions/setup-go@v2.1.4
with:
go-version: "1.16"
- uses: actions/cache@v2.1.7
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Creating minikube cluster
run: |
bash ./t/chaos/utils/setup_chaos_utils.sh start_minikube
wget https://raw.githubusercontent.com/apache/apisix-docker/master/alpine-local/Dockerfile
mkdir logs
docker build -t apache/apisix:alpine-local --build-arg APISIX_PATH=. -f Dockerfile .
minikube cache add apache/apisix:alpine-local -v 7 --alsologtostderr
- name: Print cluster information
run: |
kubectl config view
kubectl cluster-info
kubectl get nodes
kubectl get pods -n kube-system
kubectl version
- name: Deploy etcd with Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install etcd bitnami/etcd --set replicaCount=3 --set auth.rbac.enabled=false
kubectl wait pods -l app.kubernetes.io/instance=etcd --for=condition=Ready --timeout=300s --all
- name: Deploy APISIX
run: |
bash ./t/chaos/utils/setup_chaos_utils.sh modify_config
kubectl create configmap apisix-gw-config.yaml --from-file=./conf/config.yaml
kubectl apply -f ./kubernetes/deployment.yaml
kubectl apply -f ./kubernetes/service.yaml
kubectl wait pods -l app=apisix-gw --for=condition=Ready --timeout=300s
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/httpbin/httpbin.yaml
kubectl wait pods -l app=httpbin --for=condition=Ready --timeout=300s
bash ./t/chaos/utils/setup_chaos_utils.sh port_forward
- name: Deploy Chaos Mesh
run: |
curl -sSL https://mirrors.chaos-mesh.org/v2.0.1/install.sh | bash
- name: Install Ginkgo
run: |
go get -u github.com/onsi/ginkgo/ginkgo
sudo cp ~/go/bin/ginkgo /usr/local/bin
- name: Run test
working-directory: ./t/chaos
run: ginkgo -r --v --progress --trace
# Debug via SSH if previous steps failed
- name: Set up tmate session
if: ${{ failure() }}
uses: ./.github/actions/action-tmate
timeout-minutes: 15