Skip to content

Commit

Permalink
Smoke tests: Test cronjob and pods pages (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
danroux authored Apr 18, 2024
1 parent 45aee68 commit b7c5ca8
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .changelog/38.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
tests: Smoke tests: Test cronjob and pods pages
```
25 changes: 21 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ on:
workflow_dispatch:
workflow_call:
inputs:
pull_request_number:
required: true
type: number
image_tag:
required: true
type: string
k8s_version:
required: true
type: string
k8s_image:
required: true
type: string
# push:
# branches:
# - 'main'
Expand Down Expand Up @@ -45,6 +54,7 @@ jobs:
${{ vars.DOCKERHUB_SK8L_UI_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
sk8l-ui-dev-img:
runs-on: ubuntu-latest
name: sk8l-ui:dev-${{ inputs.image_tag }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down Expand Up @@ -73,9 +83,12 @@ jobs:
push: true
tags: |
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ github.event.pull_request.number }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ github.sha }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ inputs.image_tag }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:dev-${{ inputs.pull_request_number }}
sk8l-ui-pre-img:
runs-on: ubuntu-latest
name: sk8l-ui:pre-${{ inputs.image_tag }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand Down Expand Up @@ -104,10 +117,12 @@ jobs:
push: true
tags: |
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre-${{ github.event.pull_request.number }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre-${{ github.sha }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre-${{ inputs.image_tag }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:pre-${{ inputs.pull_request_number }}
sk8l-ui-test-img:
runs-on: ubuntu-latest
name: sk8l-ui:ui-test-${{ github.event.pull_request.number }}
name: sk8l-ui:ui-test-${{ inputs.image_tag }}
needs: [sk8l-ui-pre-img]
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
Expand Down Expand Up @@ -137,4 +152,6 @@ jobs:
push: true
tags: |
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test-${{ github.event.pull_request.number }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test-${{ github.sha }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test-${{ inputs.image_tag }}
${{ vars.GHCR_SK8L_UI_IMAGE_NAME }}:ui-test-${{ inputs.pull_request_number }}
15 changes: 15 additions & 0 deletions .github/workflows/k8s-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ jobs:
- name: Setup certs
run: |
make setup-certs > /dev/null
- name: Update config files with dev docker image tag
if:
run: |
pr_image_tag=pre-${{ inputs.image_tag }}
cp testdata/sk8l-values.yml testdata/sk8l-values.yml.bak
yq e -i ".sk8lUi.imageTag = \"$pr_image_tag\"" testdata/sk8l-values.yml
set +e
echo "after"
diff -C3 testdata/sk8l-values.yml.bak testdata/sk8l-values.yml
diff_status=$?
set -e
if [ $diff_status -eq 0 ]; then
echo "No differences found between the files."
exit 1
fi
- name: Install Chart
run: |
make install-chart-ci > /dev/null
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,42 @@ jobs:
name: Build Docker image dev-${{ github.event.pull_request.number }}
uses: ./.github/workflows/docker.yml
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
strategy:
matrix:
k8s:
- image: "kindest/node:v1.26.14@sha256:5d548739ddef37b9318c70cb977f57bf3e5015e4552be4e27e57280a8cbb8e4f"
version: v1.26.14
- image: "kindest/node:v1.27.11@sha256:681253009e68069b8e01aad36a1e0fa8cf18bb0ab3e5c4069b2e65cafdd70843"
version: v1.27.11
- image: "kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58"
version: v1.28.7
- image: "kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245"
version: v1.29.2
with:
image_tag: dev-${{ github.event.pull_request.number }}
image_tag: ${{ github.event.pull_request.number }}-${{ matrix.k8s.version }}
pull_request_number: ${{ github.event.pull_request.number }}
k8s_version: ${{ matrix.k8s.version }}
k8s_image: ${{ matrix.k8s.image }}
secrets: inherit
k8s-tests:
name: k8s ${{ matrix.k8s.version }}/pr#${{ github.event.pull_request.number }} tests
needs: [docker-img]
strategy:
matrix:
k8s:
- image: "kindest/node:v1.26.14@sha256:5d548739ddef37b9318c70cb977f57bf3e5015e4552be4e27e57280a8cbb8e4f"
version: v1.26.14
- image: "kindest/node:v1.27.11@sha256:681253009e68069b8e01aad36a1e0fa8cf18bb0ab3e5c4069b2e65cafdd70843"
version: v1.27.11
- image: "kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58"
version: v1.28.7
- image: "kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245"
version: v1.29.2
kind:
- version: "v0.22.0"
uses: ./.github/workflows/k8s-test.yml
with:
image_tag: dev-${{ github.event.pull_request.number }}
image_tag: ${{ github.event.pull_request.number }}-${{ matrix.k8s.version }}
pull_request_number: ${{ github.event.pull_request.number }}
kind_version: ${{ matrix.kind.version }}
k8s_version: ${{ matrix.k8s.version }}
Expand Down
2 changes: 1 addition & 1 deletion ci/ui_smoke_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

kubectl apply -f https://raw.githubusercontent.com/danroux/sk8l-api/main/testdata/sk8l-cronjobs.yml -n sk8l > /dev/null
kubectl wait -n sk8l --for=condition=ready pod -l app.kubernetes.io/pod=sk8l-ui --timeout=300s
sleep 30
sleep 10
kubectl apply -f testdata/cypress-job.yml -n sk8l
kubectl wait --for=condition=complete job.batch/cypress-job -n sk8l --timeout=600s

Expand Down
35 changes: 35 additions & 0 deletions cypress/integration/sk8l.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,39 @@ describe('Home Test', () => {
cy.contains('33%')
cy.contains('Latest completions')
})

it('visits a cronjob', () => {
cy.visit('https://sk8l-ui:8001/cronjob/sk8l/download-report-files')
cy.contains('Overview')
cy.contains('Success')
cy.contains('Active')
cy.contains('Failed')
cy.contains('Total jobs')
cy.contains('Successful Jobs')
cy.contains('Active Jobs')
cy.contains('Failed Jobs')
cy.contains('Current Duration')
cy.contains('Last Duration')
cy.contains('Avg. Duration')
cy.contains('Last Successful')

cy.contains('Schedule')
cy.contains('Every minute')
cy.contains('Container Commands')
cy.contains('Spec')
cy.contains('Completions 1')
cy.contains('Parallelism 1')
cy.contains('concurrencyPolicy Allow')
cy.contains('startingDeadlineSeconds 200')
cy.contains('suspend false')
cy.contains('successfulJobsHistoryLimit 20')
cy.contains('failedJobsHistoryLimit 20')
})

it("visits a cronjob's pods", () => {
cy.visit('https://sk8l-ui:8001/cronjob/sk8l/process-videos/pods/')
cy.contains('Node:')
cy.contains('Host:')
cy.contains('Pod Ips:')
})
})
2 changes: 0 additions & 2 deletions testdata/sk8l-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ uiService:
protocol: TCP
port: 9901
nodePort: 30965

sk8lUi:
image: "ghcr.io/danroux/sk8l-ui"
imageTag: "pre"
imagePullPolicy: "Always"

configMaps:
ui:
vite_sk8l_api_url: "https://sk8l-ui:9080"

0 comments on commit b7c5ca8

Please sign in to comment.