Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helm test #424

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def deployments(ctx):
"kind": "pipeline",
"type": "docker",
"name": "k3d",
"steps": wait(ctx) + install(ctx) + showPodsAfterInstall(ctx),
"steps": wait(ctx) + install(ctx) + showPodsAfterInstall(ctx) + helmtest(ctx),
"services": [
{
"name": "k3d",
Expand Down Expand Up @@ -256,3 +256,13 @@ def showPodsAfterInstall(config):
"kubectl get ingress",
],
}]

def helmtest(ctx):
return [{
"name": "helm-test",
"image": "docker.io/owncloudci/alpine",
"commands": [
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
"helm test --timeout 5m0s ocis --logs",
],
}]
10 changes: 5 additions & 5 deletions charts/ocis/ci/deployment-values.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 1024m
#ingressClassName: nginx
#annotations:
# nginx.ingress.kubernetes.io/proxy-body-size: 1024m
tls:
- secretName: chart-example-tls
hosts:
- ocis.owncloud.test
- host.k3d.internal

externalDomain: ocis.owncloud.test
externalDomain: host.k3d.internal

logging:
level: debug
Expand Down
71 changes: 71 additions & 0 deletions charts/ocis/templates/tests/execute-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: v1
kind: Pod
metadata:
name: "e2e-tests"
labels:
{{- include "ocis.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
initContainers:
- name: git-checkout
image: owncloudci/nodejs:18
workingDir: "/tests"
command: ['git']
args: ['clone','-b','stable-7.1','--single-branch','--no-tags','https://github.com/owncloud/web.git']
{{- include "ocis.containerSecurityContext" . | nindent 6 }}
resources: {{ toYaml .jobResources | nindent 8 }}
volumeMounts:
- name: test-dir
mountPath: /tests # we mount that volume only to apply fsGroup to that path
- name: install-pnpm
image: owncloudci/nodejs:18
workingDir: "/tests/web"
command: ['bash']
args: ['-c','pnpm config set store-dir ./.pnpm-store; pnpm install']
{{- include "ocis.containerSecurityContext" . | nindent 6 }}
resources: {{ toYaml .jobResources | nindent 8 }}
volumeMounts:
- name: test-dir
mountPath: /tests # we mount that volume only to apply fsGroup to that path
- name: install-chromium
image: owncloudci/nodejs:18
workingDir: "/tests/web"
command: ['bash']
args: ['-c','pnpm exec playwright install chromium; pnpm exec playwright install-deps']
{{- include "ocis.containerSecurityContext" . | nindent 6 }}
resources: {{ toYaml .jobResources | nindent 8 }}
volumeMounts:
- name: test-dir
mountPath: /tests # we mount that volume only to apply fsGroup to that path

containers:
- name: e2e-tests
image: owncloudci/nodejs:18
workingDir: "/tests/web"
command: ['pnpm']
args: ['test:e2e:cucumber','tests/e2e/cucumber/features/*/*[!.oc10].feature']
{{- include "ocis.containerSecurityContext" . | nindent 6 }}
resources: {{ toYaml .jobResources | nindent 8 }}
env:
- name: "BASE_URL_OCIS"
value: "host.k3d.internal"
- name: "HEADLESS"
value: "true"
- name: "BROWSER"
value: "chromium"
- name: "RETRY"
value: "1"
- name: "WEB_UI_CONFIG_FILE"
value: "/drone/src/tests/config/drone/ocis-config.json"
- name: "LOCAL_UPLOAD_DIR"
value: "/uploads"
volumeMounts:
- name: test-dir
mountPath: /tests # we mount that volume only to apply fsGroup to that path

restartPolicy: Never
volumes:
- name: test-dir
emptyDir: {}

17 changes: 17 additions & 0 deletions charts/ocis/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: "ocis-test-connection"
labels:
{{- include "ocis.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: curl
image: curlimages/curl:8.4.0
command: ['curl']
args: ['-v','-k','https://{{ .Values.externalDomain }}/']
{{- include "ocis.containerSecurityContext" . | nindent 6 }}
resources: {{ toYaml .jobResources | nindent 8 }}
restartPolicy: Never
12 changes: 5 additions & 7 deletions ci/k3d-drone.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
apiVersion: k3d.io/v1alpha4
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
name: drone
servers: 1
image: rancher/k3s:v1.28.3-k3s1
ports:
- port: 443:443
nodeFilters:
- loadbalancer
options:
k3s:
extraArgs:
- arg: --tls-san=k3d
nodeFilters:
- server:*
- arg: --disable=servicelb
nodeFilters:
- server:*
- arg: --disable=metrics-server
nodeFilters:
- server:*
- arg: --disable=traefik
nodeFilters:
- server:*