Skip to content

Commit

Permalink
Add github workflow for e2e test (anvil-verifier#204)
Browse files Browse the repository at this point in the history
Add a new yaml file in workflow called e2e-testing.yaml. It will build
and deploy two controllers and then run e2e test for each of them.

---------

Signed-off-by: ZichengMa <[email protected]>
  • Loading branch information
ZichengMa authored Aug 26, 2023
1 parent 47f4499 commit 6876572
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 6 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: e2e Testing
run-name: e2e tests run by ${{ github.actor }}
on:
push:
branches:
- main
paths-ignore:
- "README.md"
- ".gitignore"
- "doc/**"
pull_request:
workflow_dispatch:
jobs:
e2e-testing:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "^1.20"
- name: Install kind
run: go install sigs.k8s.io/[email protected]
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
# For rabbitmq
- name: Build rabbitmq controller image
run: |
cp docker/rabbitmq-controller/Dockerfile .
docker build -t local/rabbitmq-controller:v0.1.0 .
- name: Create kind cluster
run: kind create cluster --config=./e2e/deploy/kind_config.yaml
- name: Deploy rabbitmq controller
run: ./deploy.sh rabbitmq local
- name: Run rabbitmq e2e tests
run: cd e2e && cargo run -- rabbitmq
- name: Tear down kind cluster
run: kind delete clusters kind && sleep 15
# For zookeeper
- name: Build zookeeper controller image
run: |
cp docker/zookeeper-controller/Dockerfile .
docker build -t local/zookeeper-controller:v0.1.0 .
- name: Create kind cluster
run: kind create cluster --config=./e2e/deploy/kind_config.yaml
- name: Deploy zookeeper controller
run: ./deploy.sh zookeeper local
- name: Run zookeeper e2e tests
run: cd e2e && cargo run -- zookeeper
- name: Tear down kind cluster
run: kind delete clusters kind
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ "$registry" != "remote" ] && [ "$registry" != "local" ]; then
exit 2
fi

if ["$registry" = "local"]; then
if [ "$registry" = "local" ]; then
kind load docker-image local/$app-controller:v0.1.0
fi

Expand Down
9 changes: 7 additions & 2 deletions deploy/rabbitmq/deploy_local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ rules:
- configmaps
- secrets
- serviceaccounts
- roles
- rolebindings
verbs:
- "*"
- apiGroups:
Expand All @@ -54,6 +52,13 @@ rules:
- poddisruptionbudgets
verbs:
- "*"
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
- roles
verbs:
- "*"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
7 changes: 7 additions & 0 deletions deploy/rabbitmq/deploy_remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ rules:
- poddisruptionbudgets
verbs:
- "*"
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
- roles
verbs:
- "*"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
9 changes: 9 additions & 0 deletions e2e/deploy/kind_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
featureGates:
"StatefulSetAutoDeletePVC": true
4 changes: 2 additions & 2 deletions e2e/rabbitmq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: default
spec:
replicas: 3
rabbitmq:
rabbitmqConfig:
additionalConfig: |
default_user=new_user
default_pass=new_pass
default_pass=new_pass
2 changes: 1 addition & 1 deletion e2e/src/rabbitmq_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub async fn rabbitmq_e2e_test() -> Result<(), Error> {
let rabbitmq_sts_name = format!("{}-server", &rabbitmq_name);
let rabbitmq_cm_name = format!("{}-server-conf", &rabbitmq_name);

let seconds = Duration::from_secs(360);
let seconds = Duration::from_secs(600);
let start = Instant::now();
loop {
sleep(Duration::from_secs(5)).await;
Expand Down

0 comments on commit 6876572

Please sign in to comment.