diff --git a/helm/benchmark-definitions/test/test-example-execution.yaml b/helm/benchmark-definitions/test/test-example-execution.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2dc4ef5b5faf6d40e254471984683ac8ec5d77b3 --- /dev/null +++ b/helm/benchmark-definitions/test/test-example-execution.yaml @@ -0,0 +1,26 @@ +apiVersion: theodolite.com/v1 +kind: execution +metadata: + name: theodolite-test-execution +spec: + benchmark: "example-benchmark" + loads: + loadType: "NumSensors" + loadValues: [100] + resources: + resourceType: "Instances" + resourceValues: [1] + slos: + - name: "lag trend" + properties: + warmup: 0 # in seconds + execution: + strategy: + name: "RestrictionSearch" + restrictions: + - "LowerBound" + searchStrategy: "LinearSearch" + duration: 30 # in seconds + repetitions: 1 + loadGenerationDelay: 0 # in seconds + configOverrides: [] diff --git a/helm/templates/tests/test-prometheus-connection.yaml b/helm/templates/tests/test-prometheus-connection.yaml index 313a0825adf5d654642c6e1d8ff6beb4ee59df97..4c51c0854e14dc7d4d4e23e268226f99114716d4 100644 --- a/helm/templates/tests/test-prometheus-connection.yaml +++ b/helm/templates/tests/test-prometheus-connection.yaml @@ -7,7 +7,7 @@ metadata: {{- include "theodolite.labels" . | nindent 4 }} annotations: "helm.sh/hook": test - "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: containers: - name: wget diff --git a/helm/templates/tests/test-theodolite-example.yaml b/helm/templates/tests/test-theodolite-example.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d486a544dada70db5fb4e4f0d734eb8a34b23c34 --- /dev/null +++ b/helm/templates/tests/test-theodolite-example.yaml @@ -0,0 +1,52 @@ +{{- if .Values.operator.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ include "theodolite.fullname" . }}-test-example-files" + annotations: + "helm.sh/hook": test + "helm.sh/hook-weight": "1" + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +data: +{{ ($.Files.Glob "benchmark-definitions/examples/*").AsConfig | indent 2 }} +{{ ($.Files.Glob "benchmark-definitions/test/*").AsConfig | indent 2 }} +--- +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "theodolite.fullname" . }}-test-example" + labels: + {{- include "theodolite.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test + "helm.sh/hook-weight": "2" + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + restartPolicy: Never + containers: + - name: kubectl + image: bitnami/kubectl + command: + - bash + - -c + - | + cd /example-resources/ + kubectl apply -f example-configmap.yaml + kubectl apply -f example-benchmark.yaml + kubectl apply -f test-example-execution.yaml + timeout 120s bash -c "until kubectl get exec theodolite-test-execution -o json | jq -r .status.executionState | grep -i '^Finished$'; do kubectl get exec theodolite-test-execution -o json | jq -r .status.executionState; sleep 5s; done" + RETURN=$? + echo "RETURN: $RETURN" + kubectl delete -f example-configmap.yaml + kubectl delete -f example-benchmark.yaml + kubectl delete -f test-example-execution.yaml + exit $RETURN + volumeMounts: + - name: example-resources + mountPath: /example-resources + volumes: + - name: example-resources + configMap: + name: "{{ include "theodolite.fullname" . }}-test-example-files" + serviceAccountName: {{ include "theodolite.serviceAccountName" . }} +{{- end }}