Skip to content

Commit

Permalink
fix(ci): run test for preview - WIP
Browse files Browse the repository at this point in the history
Signed-off-by: WrenIX <[email protected]>
  • Loading branch information
wrenix committed Nov 4, 2024
1 parent f910cc6 commit 68a5034
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 32 deletions.
38 changes: 38 additions & 0 deletions .github/tests/test_job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: test-nextcloud
namespace: nextcloud
spec:
template:
metadata:
name: test-nextcloud
spec:
initContainers:
- name: 05-create-nextcloud-file
image: curlimages/curl
command:
- /bin/sh
- -c
- |
curl "https://upload.wikimedia.org/wikipedia/commons/c/cc/Open_Data_stickers.jpg" > test_upload.jpg && \
curl \
-w "%{http_code}" \
-u admin:changeme \
-T test_upload.jpg \
"http://nextcloud.nextcloud.svc.cluster.local:8080/remote.php/dav/files/admin/test_upload.jpg" && \
echo -e "\nTried to uploaded a file, test_upload.jpg, to Nextcloud."
- name: 10-generate-preview
image: curlimages/curl
command:
- /bin/sh
- -c
- |
curl \
-w "%{http_code}" \
-u admin:changeme \
"http://nextcloud.nextcloud.svc.cluster.local:8080/index.php/core/preview.png?file=test_upload.jpg&x=128&y=128&mimeFallback=true&a=0" \
-o - | grep -c PNG && \
echo -e "\nTried to get preview."
restartPolicy: Never
26 changes: 0 additions & 26 deletions .github/tests/test_upload_job.yaml

This file was deleted.

14 changes: 8 additions & 6 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ jobs:
# we need to skip the clean up so we can test adding a file
helm_args: |
--namespace nextcloud --skip-clean-up --helm-extra-set-args "--set=fullnameOverride=nextcloud --set=nextcloud.objectStore.s3.enabled=true --set=nextcloud.objectStore.s3.accessKey=nextcloud --set=nextcloud.objectStore.s3.secretKey=rootpass123 --set=nextcloud.objectStore.s3.host=minio.nextcloud.svc.cluster.local --set=nextcloud.objectStore.s3.port=9000 --set=nextcloud.objectStore.s3.ssl=false --set=nextcloud.objectStore.s3.bucket=nextcloud --set=nextcloud.objectStore.s3.usePathStyle=true --set=image.flavor=fpm --set=nginx.enabled=true --set=nextcloud.host=nextcloud --set=nextcloud.trustedDomains[0]='*'"
test: true

# test the helm chart with imaginary
- name: Imaginary Enabled
helm_args: --helm-extra-set-args "--values charts/nextcloud/test-values/imaginary.yaml"
helm_args: --namespace nextcloud --skip-clean-up --helm-extra-set-args "--values charts/nextcloud/test-values/imaginary.yaml"
test: true

steps:
- name: Checkout
Expand Down Expand Up @@ -142,16 +144,16 @@ jobs:
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'
- name: Run test for Nextcloud
if: matrix.test_cases.test
# applies a kubernetes job that uploads a file and then checks log of finished pod
run: |
kubectl config set-context --current --namespace=nextcloud && \
kubectl apply -f ./.github/tests/test_upload_job.yaml --wait=true && \
kubectl apply -f ./.github/tests/test_job.yaml --wait=true && \
sleep 2 && \
kubectl wait --for=condition=Complete --timeout=2m job/create-nextcloud-file && \
kubectl wait --for=condition=Complete --timeout=2m job/test-nextcloud && \
echo "Here's the logs from the job:" && \
kubectl logs --tail=-1 -f -l batch.kubernetes.io/job-name=create-nextcloud-file && \
kubectl logs --tail=-1 -f -l batch.kubernetes.io/job-name=test-nextcloud && \
echo "Here's the logs from the nextcloud pod:" && \
kubectl logs -l app.kubernetes.io/name=nextcloud
Expand Down
2 changes: 2 additions & 0 deletions charts/nextcloud/test-values/imaginary.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
fullnameOverride: nextcloud

nextcloud:
defaultConfigs:
imaginary.config.php: true
Expand Down

0 comments on commit 68a5034

Please sign in to comment.