From 19b6916f356f62507a202ead45de7ccda2e99410 Mon Sep 17 00:00:00 2001 From: dementhorr Date: Tue, 9 Jan 2024 16:05:49 +0100 Subject: [PATCH] Added initial unittests for gitea actions --- unittests/actions/config-act-runner.yaml | 20 ++++++++++++++++++++ unittests/actions/config-scripts.yaml | 20 ++++++++++++++++++++ unittests/actions/job.yaml | 20 ++++++++++++++++++++ unittests/actions/role-job.yaml | 20 ++++++++++++++++++++ unittests/actions/rolebinding-job.yaml | 20 ++++++++++++++++++++ unittests/actions/secret-token.yaml | 20 ++++++++++++++++++++ unittests/actions/serviceaccount-job.yaml | 20 ++++++++++++++++++++ unittests/actions/statefulset.yaml | 20 ++++++++++++++++++++ 8 files changed, 160 insertions(+) create mode 100644 unittests/actions/config-act-runner.yaml create mode 100644 unittests/actions/config-scripts.yaml create mode 100644 unittests/actions/job.yaml create mode 100644 unittests/actions/role-job.yaml create mode 100644 unittests/actions/rolebinding-job.yaml create mode 100644 unittests/actions/secret-token.yaml create mode 100644 unittests/actions/serviceaccount-job.yaml create mode 100644 unittests/actions/statefulset.yaml diff --git a/unittests/actions/config-act-runner.yaml b/unittests/actions/config-act-runner.yaml new file mode 100644 index 0000000..a4982e9 --- /dev/null +++ b/unittests/actions/config-act-runner.yaml @@ -0,0 +1,20 @@ +suite: actions template | config-act-runner +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/config-act-runner.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/config-act-runner.yaml + set: + actions: + statefulset: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: ConfigMap + apiVersion: v1 + name: gitea-unittests-act-runner-config diff --git a/unittests/actions/config-scripts.yaml b/unittests/actions/config-scripts.yaml new file mode 100644 index 0000000..862c554 --- /dev/null +++ b/unittests/actions/config-scripts.yaml @@ -0,0 +1,20 @@ +suite: actions template | config-scripts +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/config-scripts.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/config-scripts.yaml + set: + actions: + job: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: ConfigMap + apiVersion: v1 + name: gitea-unittests-scripts diff --git a/unittests/actions/job.yaml b/unittests/actions/job.yaml new file mode 100644 index 0000000..9702f4a --- /dev/null +++ b/unittests/actions/job.yaml @@ -0,0 +1,20 @@ +suite: actions template | job +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/job.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/job.yaml + set: + actions: + job: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: Job + apiVersion: batch/v1 + name: gitea-unittests-actions-token-job diff --git a/unittests/actions/role-job.yaml b/unittests/actions/role-job.yaml new file mode 100644 index 0000000..7aab92f --- /dev/null +++ b/unittests/actions/role-job.yaml @@ -0,0 +1,20 @@ +suite: actions template | role-job +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/role-job.yaml +tests: + - it: renders a role + template: templates/gitea/actions/role-job.yaml + set: + actions: + job: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: Role + apiVersion: rbac.authorization.k8s.io/v1 + name: gitea-unittests-actions-token-job diff --git a/unittests/actions/rolebinding-job.yaml b/unittests/actions/rolebinding-job.yaml new file mode 100644 index 0000000..ba1dc94 --- /dev/null +++ b/unittests/actions/rolebinding-job.yaml @@ -0,0 +1,20 @@ +suite: actions template | rolebinding-job +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/rolebinding-job.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/rolebinding-job.yaml + set: + actions: + job: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: RoleBinding + apiVersion: rbac.authorization.k8s.io/v1 + name: gitea-unittests-actions-token-job diff --git a/unittests/actions/secret-token.yaml b/unittests/actions/secret-token.yaml new file mode 100644 index 0000000..ed26899 --- /dev/null +++ b/unittests/actions/secret-token.yaml @@ -0,0 +1,20 @@ +suite: actions template | secret-token +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/secret-token.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/secret-token.yaml + set: + actions: + job: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: Secret + apiVersion: v1 + name: gitea-unittests-actions-token diff --git a/unittests/actions/serviceaccount-job.yaml b/unittests/actions/serviceaccount-job.yaml new file mode 100644 index 0000000..5933805 --- /dev/null +++ b/unittests/actions/serviceaccount-job.yaml @@ -0,0 +1,20 @@ +suite: actions template | serviceaccount-job +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/serviceaccount-job.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/serviceaccount-job.yaml + set: + actions: + job: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: ServiceAccount + apiVersion: v1 + name: gitea-unittests-actions-token-job diff --git a/unittests/actions/statefulset.yaml b/unittests/actions/statefulset.yaml new file mode 100644 index 0000000..89b4322 --- /dev/null +++ b/unittests/actions/statefulset.yaml @@ -0,0 +1,20 @@ +suite: actions template | statefulset +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/actions/statefulset.yaml +tests: + - it: renders a deployment + template: templates/gitea/actions/statefulset.yaml + set: + actions: + statefulset: + enabled: true + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: StatefulSet + apiVersion: apps/v1 + name: gitea-unittests-act-runner