Skip to content

Commit

Permalink
Merge pull request #289 from kubescape/unittests
Browse files Browse the repository at this point in the history
Run unittests during CI
  • Loading branch information
matthyx authored Sep 19, 2023
2 parents 3b58753 + 7cb87e9 commit 3e7c290
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pr-created.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pull_request_created
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths-ignore:
- '*.md'
- '.github/workflows/*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pr-created:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run Helm Unittests
run: docker run --rm --name unittest --volume "$(pwd)":/apps helmunittest/helm-unittest charts/kubescape-operator/
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ matches the snapshot:
- configMap:
name: kubescape-scheduler
name: kubescape-scheduler
schedule: 27 14 * * *
schedule: 1 2 3 4 5
17: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -1218,7 +1218,7 @@ matches the snapshot:
- configMap:
name: kubevuln-scheduler
name: kubevuln-scheduler
schedule: 37 11 * * *
schedule: 1 2 3 4 5
30: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -1896,7 +1896,7 @@ matches the snapshot:
45: |
apiVersion: v1
data:
cronjobTemplate: "apiVersion: batch/v1\nkind: CronJob\nmetadata:\n name: kubescape-scheduler\n namespace: kubescape\n labels:\n app: kubescape-scheduler\n tier: ks-control-plane\n armo.tier: \"kubescape-scan\"\nspec:\n schedule: \"0 8 * * *\"\n jobTemplate:\n spec:\n template:\n metadata:\n labels:\n armo.tier: \"kubescape-scan\"\n spec:\n containers:\n - name: kubescape-scheduler\n image: \"quay.io/kubescape/http-request:v0.0.14\"\n imagePullPolicy: IfNotPresent\n securityContext:\n allowPrivilegeEscalation: false\n readOnlyRootFilesystem: true\n runAsNonRoot: true\n runAsUser: 100\n resources:\n limits:\n cpu: 10m\n memory: 20Mi\n requests:\n cpu: 1m\n memory: 10Mi\n args: \n - -method=post\n - -scheme=http\n - -host=operator:4002\n - -path=v1/triggerAction\n - -headers=\"Content-Type:application/json\"\n - -path-body=/home/ks/request-body.json\n volumeMounts:\n - name: \"request-body-volume\"\n mountPath: /home/ks/request-body.json\n subPath: request-body.json\n readOnly: true\n restartPolicy: Never\n automountServiceAccountToken: false\n volumes:\n - name: \"request-body-volume\" # placeholder\n configMap:\n name: kubescape-scheduler"
cronjobTemplate: "apiVersion: batch/v1\nkind: CronJob\nmetadata:\n name: kubescape-scheduler\n namespace: kubescape\n labels:\n app: kubescape-scheduler\n tier: ks-control-plane\n armo.tier: \"kubescape-scan\"\nspec:\n schedule: \"1 2 3 4 5\"\n jobTemplate:\n spec:\n template:\n metadata:\n labels:\n armo.tier: \"kubescape-scan\"\n spec:\n containers:\n - name: kubescape-scheduler\n image: \"quay.io/kubescape/http-request:v0.0.14\"\n imagePullPolicy: IfNotPresent\n securityContext:\n allowPrivilegeEscalation: false\n readOnlyRootFilesystem: true\n runAsNonRoot: true\n runAsUser: 100\n resources:\n limits:\n cpu: 10m\n memory: 20Mi\n requests:\n cpu: 1m\n memory: 10Mi\n args: \n - -method=post\n - -scheme=http\n - -host=operator:4002\n - -path=v1/triggerAction\n - -headers=\"Content-Type:application/json\"\n - -path-body=/home/ks/request-body.json\n volumeMounts:\n - name: \"request-body-volume\"\n mountPath: /home/ks/request-body.json\n subPath: request-body.json\n readOnly: true\n restartPolicy: Never\n automountServiceAccountToken: false\n volumes:\n - name: \"request-body-volume\" # placeholder\n configMap:\n name: kubescape-scheduler"
kind: ConfigMap
metadata:
labels:
Expand All @@ -1907,7 +1907,7 @@ matches the snapshot:
46: |
apiVersion: v1
data:
cronjobTemplate: "apiVersion: batch/v1\nkind: CronJob\nmetadata:\n name: kubevuln-scheduler\n namespace: kubescape\n labels:\n app: kubevuln-scheduler\n tier: ks-control-plane\n armo.tier: \"vuln-scan\"\nspec:\n schedule: \"0 0 * * *\" \n jobTemplate:\n spec:\n template:\n metadata:\n labels:\n armo.tier: \"vuln-scan\"\n spec:\n containers:\n - name: kubevuln-scheduler\n image: \"quay.io/kubescape/http-request:v0.0.14\"\n imagePullPolicy: IfNotPresent\n securityContext:\n allowPrivilegeEscalation: false\n readOnlyRootFilesystem: true\n runAsNonRoot: true\n runAsUser: 100\n resources:\n limits:\n cpu: 10m\n memory: 20Mi\n requests:\n cpu: 1m\n memory: 10Mi\n args: \n - -method=post\n - -scheme=http\n - -host=operator:4002\n - -path=v1/triggerAction\n - -headers=\"Content-Type:application/json\"\n - -path-body=/home/ks/request-body.json\n volumeMounts:\n - name: \"request-body-volume\"\n mountPath: /home/ks/request-body.json\n subPath: request-body.json\n readOnly: true\n restartPolicy: Never\n automountServiceAccountToken: false\n volumes:\n - name: \"request-body-volume\" # placeholder\n configMap:\n name: kubevuln-scheduler"
cronjobTemplate: "apiVersion: batch/v1\nkind: CronJob\nmetadata:\n name: kubevuln-scheduler\n namespace: kubescape\n labels:\n app: kubevuln-scheduler\n tier: ks-control-plane\n armo.tier: \"vuln-scan\"\nspec:\n schedule: \"1 2 3 4 5\" \n jobTemplate:\n spec:\n template:\n metadata:\n labels:\n armo.tier: \"vuln-scan\"\n spec:\n containers:\n - name: kubevuln-scheduler\n image: \"quay.io/kubescape/http-request:v0.0.14\"\n imagePullPolicy: IfNotPresent\n securityContext:\n allowPrivilegeEscalation: false\n readOnlyRootFilesystem: true\n runAsNonRoot: true\n runAsUser: 100\n resources:\n limits:\n cpu: 10m\n memory: 20Mi\n requests:\n cpu: 1m\n memory: 10Mi\n args: \n - -method=post\n - -scheme=http\n - -host=operator:4002\n - -path=v1/triggerAction\n - -headers=\"Content-Type:application/json\"\n - -path-body=/home/ks/request-body.json\n volumeMounts:\n - name: \"request-body-volume\"\n mountPath: /home/ks/request-body.json\n subPath: request-body.json\n readOnly: true\n restartPolicy: Never\n automountServiceAccountToken: false\n volumes:\n - name: \"request-body-volume\" # placeholder\n configMap:\n name: kubevuln-scheduler"
kind: ConfigMap
metadata:
labels:
Expand Down
2 changes: 2 additions & 0 deletions charts/kubescape-operator/tests/snapshot_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ tests:
proxySecretFile: foo
grypeOfflineDB.enabled: true
kubescape.serviceMonitor.enabled: true
kubescapeScheduler.scanSchedule: "1 2 3 4 5"
kubevulnScheduler.scanSchedule: "1 2 3 4 5"

0 comments on commit 3e7c290

Please sign in to comment.