From bbf504aced186d3eca47d9c25230fc7ff3988c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 21 Feb 2024 16:36:18 +0100 Subject: [PATCH] test: add chainsaw basic test (#1415) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: add chainsaw basic test Signed-off-by: Charles-Edouard Brétéché * fix debug logs Signed-off-by: Charles-Edouard Brétéché * fix debug logs Signed-off-by: Charles-Edouard Brétéché * fix debug logs Signed-off-by: Charles-Edouard Brétéché * fix debug logs Signed-off-by: Charles-Edouard Brétéché * fix debug logs Signed-off-by: Charles-Edouard Brétéché --------- Signed-off-by: Charles-Edouard Brétéché Co-authored-by: Hubert Stefanski <35736504+HubertStefanski@users.noreply.github.com> --- tests/e2e/examples/basic/assertions.yaml | 37 ++++++++++++++ tests/e2e/examples/basic/chainsaw-test.yaml | 13 +++++ tests/e2e/examples/basic/resources.yaml | 55 +++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 tests/e2e/examples/basic/assertions.yaml create mode 100755 tests/e2e/examples/basic/chainsaw-test.yaml create mode 100644 tests/e2e/examples/basic/resources.yaml diff --git a/tests/e2e/examples/basic/assertions.yaml b/tests/e2e/examples/basic/assertions.yaml new file mode 100644 index 000000000..11289a438 --- /dev/null +++ b/tests/e2e/examples/basic/assertions.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grafana-deployment + ownerReferences: + - apiVersion: grafana.integreatly.org/v1beta1 + kind: Grafana + name: grafana +spec: {} +--- +apiVersion: v1 +kind: Service +metadata: + name: grafana-service + ownerReferences: + - apiVersion: grafana.integreatly.org/v1beta1 + kind: Grafana + name: grafana +spec: {} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-ini + ownerReferences: + - apiVersion: grafana.integreatly.org/v1beta1 + kind: Grafana + name: grafana +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-plugins + ownerReferences: + - apiVersion: grafana.integreatly.org/v1beta1 + kind: Grafana + name: grafana diff --git a/tests/e2e/examples/basic/chainsaw-test.yaml b/tests/e2e/examples/basic/chainsaw-test.yaml new file mode 100755 index 000000000..5c201e786 --- /dev/null +++ b/tests/e2e/examples/basic/chainsaw-test.yaml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + name: basic +spec: + steps: + - name: step-00 + try: + - apply: + file: resources.yaml + - assert: + file: assertions.yaml diff --git a/tests/e2e/examples/basic/resources.yaml b/tests/e2e/examples/basic/resources.yaml new file mode 100644 index 000000000..0937c7b4e --- /dev/null +++ b/tests/e2e/examples/basic/resources.yaml @@ -0,0 +1,55 @@ +apiVersion: grafana.integreatly.org/v1beta1 +kind: Grafana +metadata: + name: grafana + labels: + dashboards: "grafana" +spec: + config: + log: + mode: "console" + auth: + disable_login_form: "false" + security: + admin_user: root + admin_password: secret +--- +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + name: grafanadashboard-sample +spec: + resyncPeriod: 30s + instanceSelector: + matchLabels: + dashboards: "grafana" + json: > + { + "id": null, + "title": "Simple Dashboard", + "tags": [], + "style": "dark", + "timezone": "browser", + "editable": true, + "hideControls": false, + "graphTooltip": 1, + "panels": [], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "time_options": [], + "refresh_intervals": [] + }, + "templating": { + "list": [] + }, + "annotations": { + "list": [] + }, + "refresh": "5s", + "schemaVersion": 17, + "version": 0, + "links": [] + }