Trying out a readiness check Added init-container for dind Use a more graceful netcat command Slimmed some things down Added docker cli and use that for its readiness check fix: unittest Added parameter for deploying multiple runners Fix unittest job remove reference nc command remove reference in unittest again Trying to fix unittests Passing unit tests readme update readme making using pnpm
216 lines
6.8 KiB
YAML
216 lines
6.8 KiB
YAML
suite: actions template | statefulset
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/statefulset.yaml
|
|
- templates/config-act-runner.yaml
|
|
tests:
|
|
- it: doesn't renders a StatefulSet by default
|
|
template: templates/statefulset.yaml
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
- it: renders a StatefulSet (with given existingSecret/existingSecretKey)
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
enabled: true
|
|
existingSecret: "my-secret"
|
|
existingSecretKey: "my-secret-key"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- equal:
|
|
path: spec.template.spec.containers[0].env[3]
|
|
value:
|
|
name: GITEA_RUNNER_REGISTRATION_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: "my-secret"
|
|
key: "my-secret-key"
|
|
- it: renders a StatefulSet (with secret reference defaults for enabled provisioning)
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
enabled: true
|
|
provisioning:
|
|
enabled: true
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- equal:
|
|
path: spec.template.spec.containers[0].env[3]
|
|
value:
|
|
name: GITEA_RUNNER_REGISTRATION_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: "gitea-unittests-actions-token"
|
|
key: "token"
|
|
- it: renders a StatefulSet (that tracks changes of the runner configuration as annotation)
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
image.tag: "1.22.3" # lock image tag to prevent test failures on future Gitea upgrades
|
|
enabled: true
|
|
existingSecret: "my-secret"
|
|
existingSecretKey: "my-secret-key"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- equal:
|
|
path: spec.template.metadata.annotations["checksum/config"]
|
|
value: "e01f6cc186c5b523cba245cbfc9d556df49a71f7f650c979c2dbfd2bf40b9098"
|
|
- it: renders a StatefulSet http (with correct GITEA_INSTANCE_URL env from giteaRootURL)
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
giteaRootURL: "https://git.example.com"
|
|
enabled: true
|
|
existingSecret: "my-secret"
|
|
existingSecretKey: "my-secret-key"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- equal:
|
|
path: spec.template.spec.containers[0].env[4]
|
|
value:
|
|
name: GITEA_INSTANCE_URL
|
|
value: "https://git.example.com"
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].command[2]
|
|
value: |
|
|
echo 'Waiting for gitea...'
|
|
while ! wget -qO- https://git.example.com > /dev/null; do
|
|
sleep 2
|
|
done
|
|
- it: renders a StatefulSet https (with correct GITEA_INSTANCE_URL env from giteaRootURL)
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
giteaRootURL: "https://git.example.com"
|
|
enabled: true
|
|
existingSecret: "my-secret"
|
|
existingSecretKey: "my-secret-key"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- equal:
|
|
path: spec.template.spec.containers[0].env[4]
|
|
value:
|
|
name: GITEA_INSTANCE_URL
|
|
value: "https://git.example.com"
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].command[2]
|
|
value: |
|
|
echo 'Waiting for gitea...'
|
|
while ! wget -qO- https://git.example.com > /dev/null; do
|
|
sleep 2
|
|
done
|
|
- it: renders a StatefulSet https (with correct GITEA_INSTANCE_URL env from giteaRootURL)
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
giteaRootURL: "https://git.example.com"
|
|
enabled: true
|
|
existingSecret: "my-secret"
|
|
existingSecretKey: "my-secret-key"
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- equal:
|
|
path: spec.template.spec.containers[0].env[4]
|
|
value:
|
|
name: GITEA_INSTANCE_URL
|
|
value: "https://git.example.com"
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].command[2]
|
|
value: |
|
|
echo 'Waiting for gitea...'
|
|
while ! wget -qO- https://git.example.com > /dev/null; do
|
|
sleep 2
|
|
done
|
|
- it: allows adding custom environment variables to the docker-in-docker container
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
enabled: true
|
|
statefulset:
|
|
dind:
|
|
extraEnvs:
|
|
- name: "CUSTOM_ENV_NAME"
|
|
value: "custom env value"
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[1].env[3]
|
|
value:
|
|
name: "CUSTOM_ENV_NAME"
|
|
value: "custom env value"
|
|
- it: should mount an extra volume in the act runner container
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
enabled: true
|
|
statefulset:
|
|
extraVolumes:
|
|
- name: my-act-runner-volume
|
|
emptyDir: {}
|
|
actRunner:
|
|
extraVolumeMounts:
|
|
- mountPath: /mnt
|
|
name: my-act-runner-volume
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- contains:
|
|
any: true
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
content:
|
|
mountPath: /mnt
|
|
name: my-act-runner-volume
|
|
- it: should mount an extra volume in the docker-in-docker container
|
|
template: templates/statefulset.yaml
|
|
set:
|
|
enabled: true
|
|
statefulset:
|
|
extraVolumes:
|
|
- name: my-dind-volume
|
|
emptyDir: {}
|
|
dind:
|
|
extraVolumeMounts:
|
|
- mountPath: /mnt
|
|
name: my-dind-volume
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: StatefulSet
|
|
apiVersion: apps/v1
|
|
name: gitea-unittests-actions-act-runner
|
|
- contains:
|
|
any: true
|
|
path: spec.template.spec.containers[1].volumeMounts
|
|
content:
|
|
mountPath: /mnt
|
|
name: my-dind-volume
|