From d891570795e8bee1b6404464cbf3f12419b7cd99 Mon Sep 17 00:00:00 2001 From: Tao Li Date: Thu, 14 Nov 2024 15:26:04 +0800 Subject: [PATCH] add unit test Signed-off-by: Tao Li --- .github/workflows/continuous-delivery.yml | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 5c02354..0f62a17 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -12,6 +12,7 @@ jobs: outputs: pg4k-pgd-changed: ${{ steps.filter.outputs.pg4k-pgd-changed }} ep4k-changed: ${{ steps.filter.outputs.ep4k-changed }} + ep4k-lts-changed: ${{ steps.filter.outputs.ep4k-lts-changed }} steps: - name: Checkout uses: actions/checkout@v4.2.2 @@ -26,6 +27,8 @@ jobs: - 'charts/edb-postgres-distributed-for-kubernetes/**' ep4k-changed: - 'charts/edb-postgres-for-kubernetes/**' + ep4k-lts-changed: + - 'charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/**' deploy-ep4k: runs-on: ubuntu-22.04 @@ -61,6 +64,40 @@ jobs: PHASE="Cluster in healthy state" kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example + deploy-ep4k-lts: + runs-on: ubuntu-22.04 + needs: + - change-triage + if: needs.change-triage.outputs.ep4k-lts-changed == 'true' + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4 + with: + version: v3.11.3 + + - name: Create kind cluster + uses: helm/kind-action@v1.10.0 + + - name: Deploy using helm chart + run: | + helm upgrade --install edb-pg4k-lts --namespace postgresql-operator-system \ + --create-namespace charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts --wait + + - name: Install kubectl + uses: azure/setup-kubectl@v4 + + - name: Deploy a cluster + run: | + kubectl apply -f hack/samples/ep4k-cluster.yaml + + PHASE="Cluster in healthy state" + kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example + deploy-pg4k-pgd: runs-on: ubuntu-22.04 needs: @@ -141,3 +178,42 @@ jobs: kubectl create ns test-ignore kubectl -n test-ignore apply -f hack/samples/ep4k-cluster.yaml kubectl -n test-ignore get pods 2>&1 >/dev/null | grep 'No resources found' + + deploy-ep4k-lts-single-namespace: + runs-on: ubuntu-22.04 + needs: + - change-triage + if: needs.change-triage.outputs.ep4k-lts-changed == 'true' + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4 + with: + version: v3.11.3 + + - name: Create kind cluster + uses: helm/kind-action@v1.10.0 + + - name: Deploy in single-namespace mode using helm chart + run: | + helm upgrade --install edb-pg4k-lts --namespace single-install \ + --set config.clusterWide=false \ + --create-namespace charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts --wait + - name: Install kubectl + uses: azure/setup-kubectl@v4 + + - name: Deploy a cluster in the watched namespace + run: | + kubectl -n single-install apply -f hack/samples/ep4k-cluster.yaml + PHASE="Cluster in healthy state" + kubectl -n single-install wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example + + - name: Ignore deploying a cluster in another namespace + run: | + kubectl create ns test-ignore + kubectl -n test-ignore apply -f hack/samples/ep4k-cluster.yaml + kubectl -n test-ignore get pods 2>&1 >/dev/null | grep 'No resources found' \ No newline at end of file