Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add chainsaw basic test #1415

Merged
merged 10 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tests/e2e/examples/basic/assertions.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions tests/e2e/examples/basic/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions tests/e2e/examples/basic/resources.yaml
Original file line number Diff line number Diff line change
@@ -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": []
}