Skip to content

Commit

Permalink
add a k8s Job to test uploading a file to nextcloud which should be u…
Browse files Browse the repository at this point in the history
…sing S3

Signed-off-by: jessebot <[email protected]>
  • Loading branch information
jessebot committed Jul 24, 2024
1 parent bb59f62 commit dc77117
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .github/minio_test_values.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
## minio helm chart values for use in ci tests:
# https://github.com/minio/minio/blob/master/helm/minio/values.yaml

# make service name predictable
fullnameOverride: minio

## minio mode, i.e. standalone or distributed
mode: standalone

## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
requests:
memory: 1Gi

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
enabled: false

# default credentials
rootUser: nextcloud
rootPassword: rootpass123

Expand Down
24 changes: 24 additions & 0 deletions .github/test_upload_job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: create-nextcloud-file
spec:
template:
metadata:
name: create-nextcloud-file
spec:
containers:
- name: create-nextcloud-file
image: alpine
command:
- |
/bin/sh
-c
echo "testing123" > test_upload.txt && \
curl \
-u nextcloud:changeme \
-T test_upload.txt \
"https://nextcloud.nextcloud.cluster.local.svc/nextcloud/remote.php/dav/files/nextcloud/test_upload.txt" && \
echo "success"
restartPolicy: Never
22 changes: 17 additions & 5 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
# test the helm chart with s3 as the primary storage
- name: S3 Enabled as Primary Storage
# we need to skip the clean up so we can test adding a file
helm_args: '--skip-clean-up --helm-extra-set-args "--set=nextcloud.objectStore.s3.enabled=true --set-nextcloud.objectStore.s3.accessKey=nextcloud --set-nextcloud.objectStore.s3.secretKey=rootpass123 --set-nextcloud.objectStore.s3.host=minio.minio.cluster.local.svc --set-nextcloud.objectStore.s3.port=9000 --set-nextcloud.objectStore.s3.bucket=nextcloud" && echo "Success 🎉"'
helm_args: '--namespace nextcloud --skip-clean-up --helm-extra-set-args "--set=nextcloud.objectStore.s3.enabled=true --set-nextcloud.objectStore.s3.accessKey=nextcloud --set-nextcloud.objectStore.s3.secretKey=rootpass123 --set-nextcloud.objectStore.s3.host=minio.minio.cluster.local.svc --set-nextcloud.objectStore.s3.port=9000 --set-nextcloud.objectStore.s3.bucket=nextcloud" && echo "Success 🎉"'

steps:
- name: Checkout
Expand Down Expand Up @@ -119,24 +119,36 @@ jobs:

- name: Install MinIO for testing S3 as Primary Storage
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
# installs minio community helm chart here: https://github.com/minio/minio/tree/master/helm/minio
# installs minio community helm chart here:
# https://github.com/minio/minio/tree/master/helm/minio
run: |
helm repo add minio https://charts.min.io/
helm repo add minio https://charts.min.io/ && \
helm install minio \
--namespace minio \
--create-namespace \
--wait \
--wait-for-jobs \
--timeout 2m0s \
--values .github/minio_test_values.yaml \
minio/minio
minio/minio && \
kubectl create namespace nextcloud
- name: Run chart-testing (install ${{ matrix.test_cases.name }})
id: install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }}

- name: Try adding a file to Nextcloud
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
# applies a kubernetes job that uploads a file and then checks log of finished pod
run: |
kubectl apply -f ./.github/test_upload_job.yaml --wait=true && \
kubectl logs batch.kubernetes.io/job-name=test-file-upload
summary:
runs-on: ubuntu-latest-low
needs: [changes, test]
if: always()
steps:
- name: Summary
run: if ${{ needs.changes.outputs.src != 'false' && needs.run-tests.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi

0 comments on commit dc77117

Please sign in to comment.