From c4cbeaf7e2c220de31f75de7ee236fd80bc7dcdd Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Wed, 18 Oct 2023 20:46:29 +0000 Subject: [PATCH] add e2e tests --- .github/actions/validate-endpoints/action.yml | 5 ++ .github/workflows/main.yaml | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/.github/actions/validate-endpoints/action.yml b/.github/actions/validate-endpoints/action.yml index 0e205eea..077a208f 100644 --- a/.github/actions/validate-endpoints/action.yml +++ b/.github/actions/validate-endpoints/action.yml @@ -20,6 +20,10 @@ inputs: description: 'If the chart was deployed via kubectl after running helm template' required: false default: 'false' + is-airgap: + description: 'If the chart was deployed in airgap mode' + required: false + default: 'false' runs: using: "composite" steps: @@ -110,6 +114,7 @@ runs: fi - name: Validate /app/updates endpoint + if: ${{ inputs.is-airgap }} == 'false' shell: bash run: | updatesLength=$(curl -s --fail --show-error localhost:8888/api/v1/app/updates | jq '. | length' | tr -d '\n') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index aa708e6f..5dc28dd7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -464,6 +464,52 @@ jobs: helm template test-chart oci://registry.replicated.com/$APP_SLUG/$CHANNEL_SLUG/test-chart --set replicated.integration.enabled=false -f test-values.yaml | kubectl delete -f - kubectl wait --for=delete deployment/test-chart --timeout=2m kubectl wait --for=delete deployment/replicated --timeout=2m + + # validate airgap + - name: Install via Helm as subchart in production mode + run: | + helm install test-chart oci://registry.replicated.com/$APP_SLUG/$CHANNEL_SLUG/test-chart --set replicated.integration.enabled=false --set replicated.isAirgap=true --wait --timeout 2m + + kubectl wait --for=condition=exists secret/replicated-instance-report --timeout=1m + + - name: Validate endpoints + uses: ./.github/actions/validate-endpoints + with: + license-id: ${{ env.LICENSE_ID }} + license-fields: ${{ env.LICENSE_FIELDS }} + integration-enabled: 'false' + is-airgap: 'true' + + - name: Uninstall test-chart via Helm + run: | + helm uninstall test-chart --wait --timeout 2m + + kubectl wait --for=delete secret/replicated-instance-report --timeout=1m + + - name: Install via kubectl as subchart in production mode + run: | + helm template test-chart oci://registry.replicated.com/$APP_SLUG/$CHANNEL_SLUG/test-chart --set replicated.integration.enabled=false --set replicated.isAirgap=true | kubectl apply -f - + kubectl rollout status deployment test-chart --timeout=2m + kubectl rollout status deployment replicated --timeout=2m + + kubectl wait --for=condition=exists secret/replicated-instance-report --timeout=1m + + - name: Validate endpoints + uses: ./.github/actions/validate-endpoints + with: + license-id: ${{ env.LICENSE_ID }} + license-fields: ${{ env.LICENSE_FIELDS }} + integration-enabled: 'false' + deployed-via-kubectl: 'true' + is-airgap: 'true' + + - name: Uninstall test-chart via kubectl + run: | + helm template test-chart oci://registry.replicated.com/$APP_SLUG/$CHANNEL_SLUG/test-chart --set replicated.integration.enabled=false --set replicated.isAirgap=true | kubectl delete -f - + kubectl wait --for=delete deployment/test-chart --timeout=2m + kubectl wait --for=delete deployment/replicated --timeout=2m + + kubectl wait --for=delete secret/replicated-instance-report --timeout=1m - name: Remove Cluster uses: replicatedhq/replicated-actions/remove-cluster@v1.1.1