Skip to content

Commit

Permalink
add to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig O'Donnell committed Oct 5, 2023
1 parent 52f976c commit 8083a97
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/actions/validate-endpoints/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ runs:
- name: Validate /app/info endpoint
shell: bash
env:
VERSION_LABEL: ${{ inputs.version-label }}
run: |
appStatus=$(curl -s --fail --show-error localhost:8888/api/v1/app/info | jq -r .appStatus | tr -d '\n')
Expand All @@ -101,11 +99,11 @@ runs:
exit 1
fi
if [ -n "$VERSION_LABEL" ]; then
if [ -n "${{ inputs.version-label }}" ]; then
versionLabel=$(curl -s --fail --show-error localhost:8888/api/v1/app/info | jq -r .currentRelease.versionLabel | tr -d '\n')
if [ "$versionLabel" != "$VERSION_LABEL" ]; then
echo "Expected version label to be '$VERSION_LABEL', but is '$versionLabel'."
if [ "$versionLabel" != "${{ inputs.version-label }}" ]; then
echo "Expected version label to be '${{ inputs.version-label }}', but is '$versionLabel'."
exit 1
fi
fi
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,18 @@ jobs:

- name: Upgrade via Helm as subchart in production mode to a new version
run: |
oldpodname=$(kubectl get pods -l app.kubernetes.io/name=replicated -o jsonpath='{.items[0].metadata.name}')
helm upgrade test-chart oci://registry.replicated.com/$APP_SLUG/$CHANNEL_SLUG/test-chart --set replicated.integration.enabled=false --set replicated.versionLabel=1.0.0 --wait --timeout 2m
newpodname=$(kubectl get pods -l app.kubernetes.io/name=replicated -o jsonpath='{.items[0].metadata.name}')
# ensure the deployment restarted
if [ "$oldpodname" == "$newpodname" ]; then
echo "Pod did not restart after upgrade"
exit 1
fi
- name: Validate endpoints
uses: ./.github/actions/validate-endpoints
with:
Expand All @@ -298,6 +308,31 @@ jobs:
integration-enabled: 'false'
deployed-via-kubectl: 'true'

- name: Upgrade via kubectl as subchart in production mode
run: |
oldpodname=$(kubectl get pods -l app.kubernetes.io/name=replicated -o jsonpath='{.items[0].metadata.name}')
helm template test-chart oci://registry.replicated.com/$APP_SLUG/$CHANNEL_SLUG/test-chart --set replicated.integration.enabled=false | kubectl apply -f -
kubectl rollout status deployment test-chart --timeout=2m
kubectl rollout status deployment replicated --timeout=2m
newpodname=$(kubectl get pods -l app.kubernetes.io/name=replicated -o jsonpath='{.items[0].metadata.name}')
# ensure the deployment restarted
if [ "$oldpodname" == "$newpodname" ]; then
echo "Pod did not restart after upgrade"
exit 1
fi
- name: Validate endpoints
uses: ./.github/actions/validate-endpoints
with:
license-id: ${{ env.LICENSE_ID }}
license-fields: ${{ env.LICENSE_FIELDS }}
integration-enabled: 'false'
version-label: '1.0.0'
deployed-via-kubectl: '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 | kubectl delete -f -
Expand Down

0 comments on commit 8083a97

Please sign in to comment.