Skip to content

Commit

Permalink
test: add e2e tests for tls
Browse files Browse the repository at this point in the history
  • Loading branch information
theSuess committed Sep 24, 2024
1 parent 2cec198 commit 4ebb186
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/e2e/example-test/11-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata:
name: grafana-tls
spec:
version: 10.4.3
status:
(wildcard('https://grafana-tls-service.*:3000', adminUrl || '')): true
stage: complete
stageStatus: success
version: 10.4.3
143 changes: 143 additions & 0 deletions tests/e2e/example-test/11-tls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Test against a grafana instance with tls configured. Can only check if the
# connection works with verification disabled as the chainsaw namespace (and
# thus service name) will be randomized
---
apiVersion: v1
kind: Secret
metadata:
name: grafana-tls
stringData:
ca.crt: |
-----BEGIN CERTIFICATE-----
MIIFZzCCA0+gAwIBAgIUWzpYZ6viqfCXkhySqjiK9mOKEIgwDQYJKoZIhvcNAQEL
BQAwQjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UE
CgwTRGVmYXVsdCBDb21wYW55IEx0ZDAgFw0yNDA5MjQwOTE0MjRaGA8yMTIyMDMx
NTA5MTQyNFowQjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEc
MBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDCCAiIwDQYJKoZIhvcNAQEBBQAD
ggIPADCCAgoCggIBALLsqLCaXENHmztf8Op6lhQlld4+cL6iy8fradW7yxuKXVBx
VpYsJUaKjotYyHSX+gC/gdXQ170lZ8tMUz+quETic24mhEAZR/QOcsdSMv0J+5VR
TsfFtOqle0ZgAvAyTx9Wl0mxEFUVE3Pkk/693oJHtNSy+YAbM/4lh/+EPXiJgbRw
eGEmGN7LBQEPLVcGxRxkhH8oC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ZynPLJceB6uVBqtAsGT6pOfR5vxvohBy61CcIrHvWsU7R0z
4hZxROjpndcqjiQBTSmzTcxrVlMAWRX293j6d/qz7r94eeQkPtw76hYdj4iZxOkw
RO2LJYQTlxtnekPTqP+Gx136wnNe8t0DqB0sn9ECgYAaVWsMdtUnLfo7aEpYDp2p
4luli+DDb78hxXlh54YNgz42GLUNoAALpKq+Ur8oFMK5erlI6WSXSlG8t+V647Fh
xg26DHY7Sv56YjAa5LQzMNjlVFDuNU0ocaB4RWmHpRt5w4+Ujj9wqD7kTfro+n4L
Ld3vLJJdQcOqHoIIoiBm/A==
-----END PRIVATE KEY-----
---
apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata:
name: grafana-tls
labels:
dashboards: "grafana-tls"
spec:
client:
tls:
insecureSkipVerify: true
config:
server:
ca_cert: /certs/ca.crt
cert_file: /certs/tls.crt
cert_key: /certs/tls.key
domain: operator-test.grafana-operator.com
protocol: https
root_url: https://operator-test.grafana-operator.com
deployment:
spec:
template:
spec:
containers:
- name: grafana
readinessProbe:
httpGet:
port: 3000
scheme: HTTPS
volumeMounts:
- mountPath: /certs/ca.crt
name: tls
readOnly: true
subPath: ca.crt
- mountPath: /certs/tls.crt
name: tls
readOnly: true
subPath: tls.crt
- mountPath: /certs/tls.key
name: tls
readOnly: true
subPath: tls.key
volumes:
- name: tls
secret:
secretName: grafana-tls
6 changes: 6 additions & 0 deletions tests/e2e/example-test/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@ spec:
file: 10-notification-policy.yaml
- assert:
file: 10-assert.yaml
- name: step-11
try:
- apply:
file: 11-tls.yaml
- assert:
file: 11-assert.yaml

0 comments on commit 4ebb186

Please sign in to comment.