diff --git a/.github/workflows/e2e-testing.yml b/.github/workflows/e2e-testing.yml new file mode 100644 index 000000000..7d7988686 --- /dev/null +++ b/.github/workflows/e2e-testing.yml @@ -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/kind@v0.20.0 + - 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 diff --git a/deploy.sh b/deploy.sh index 18385c5e6..716f1317f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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 diff --git a/deploy/rabbitmq/deploy_local.yaml b/deploy/rabbitmq/deploy_local.yaml index b20dd0d32..01bb4d26e 100644 --- a/deploy/rabbitmq/deploy_local.yaml +++ b/deploy/rabbitmq/deploy_local.yaml @@ -35,8 +35,6 @@ rules: - configmaps - secrets - serviceaccounts - - roles - - rolebindings verbs: - "*" - apiGroups: @@ -54,6 +52,13 @@ rules: - poddisruptionbudgets verbs: - "*" + - apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + - roles + verbs: + - "*" --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/deploy/rabbitmq/deploy_remote.yaml b/deploy/rabbitmq/deploy_remote.yaml index 15683a413..ac0707653 100644 --- a/deploy/rabbitmq/deploy_remote.yaml +++ b/deploy/rabbitmq/deploy_remote.yaml @@ -54,6 +54,13 @@ rules: - poddisruptionbudgets verbs: - "*" + - apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + - roles + verbs: + - "*" --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/e2e/deploy/kind_config.yaml b/e2e/deploy/kind_config.yaml new file mode 100644 index 000000000..f6343049b --- /dev/null +++ b/e2e/deploy/kind_config.yaml @@ -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 diff --git a/e2e/rabbitmq.yaml b/e2e/rabbitmq.yaml index 945995afd..3bb210bc8 100644 --- a/e2e/rabbitmq.yaml +++ b/e2e/rabbitmq.yaml @@ -5,7 +5,7 @@ metadata: namespace: default spec: replicas: 3 - rabbitmq: + rabbitmqConfig: additionalConfig: | default_user=new_user - default_pass=new_pass \ No newline at end of file + default_pass=new_pass diff --git a/e2e/src/rabbitmq_e2e.rs b/e2e/src/rabbitmq_e2e.rs index 4b96beec4..663b9bac1 100644 --- a/e2e/src/rabbitmq_e2e.rs +++ b/e2e/src/rabbitmq_e2e.rs @@ -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;