File tree 1 file changed +130
-0
lines changed
tests/e2e/force_delete_folder
1 file changed +130
-0
lines changed Original file line number Diff line number Diff line change
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
2
+ apiVersion : chainsaw.kyverno.io/v1alpha1
3
+ kind : Test
4
+ metadata :
5
+ name : force-delete-folders
6
+ spec :
7
+ bindings :
8
+ - name : USER
9
+ value : root
10
+ - name : PASS
11
+ value : secret
12
+ steps :
13
+ - name : Create Grafana with testdata resources
14
+ try :
15
+ - apply :
16
+ file : ../testdata-resources.yaml
17
+
18
+ - assert :
19
+ resource :
20
+ apiVersion : v1
21
+ kind : Pod
22
+ metadata :
23
+ (contains(name, 'testdata-deployment')) : true
24
+
25
+ - wait :
26
+ apiVersion : v1
27
+ kind : Pod
28
+ timeout : 1m
29
+ for :
30
+ condition :
31
+ name : Ready
32
+ value : ' true'
33
+
34
+ - assert :
35
+ resource :
36
+ apiVersion : grafana.integreatly.org/v1beta1
37
+ kind : Grafana
38
+ metadata :
39
+ name : testdata
40
+ status :
41
+ stage : complete
42
+ stageStatus : success
43
+
44
+ - assert :
45
+ resource :
46
+ apiVersion : grafana.integreatly.org/v1beta1
47
+ kind : GrafanaFolder
48
+ metadata :
49
+ name : testdata
50
+ status :
51
+ conditions :
52
+ - reason : ApplySuccessful
53
+ status : " True"
54
+ type : FolderSynchronized
55
+
56
+ - assert :
57
+ resource :
58
+ apiVersion : grafana.integreatly.org/v1beta1
59
+ kind : GrafanaAlertRuleGroup
60
+ metadata :
61
+ name : testdata
62
+ status :
63
+ conditions :
64
+ - reason : ApplySuccessful
65
+ status : " True"
66
+ type : AlertGroupSynchronized
67
+
68
+ - name : Ensure folder exists in Grafana
69
+ try :
70
+ - apply : &curlJob
71
+ resource :
72
+ apiVersion : batch/v1
73
+ kind : Job
74
+ metadata :
75
+ name : folder-curl
76
+ spec :
77
+ backoffLimit : 1
78
+ template :
79
+ spec :
80
+ restartPolicy : Never
81
+ containers :
82
+ - name : curl
83
+ image : alpine/curl:latest
84
+ command : ["ash", "-c"]
85
+ args :
86
+ - |
87
+ curl --fail --silent --show-error \
88
+ -u ${BASIC_USER}:${BASIC_PASS} \
89
+ "http://testdata-service.${NS}.svc:3000/api/folders/testdata-uid"
90
+ env :
91
+ - name : BASIC_USER
92
+ value : ($USER)
93
+ - name : BASIC_PASS
94
+ value : ($PASS)
95
+ - name : NS
96
+ value : ($namespace)
97
+ - assert :
98
+ resource :
99
+ apiVersion : batch/v1
100
+ kind : Job
101
+ metadata :
102
+ name : folder-curl
103
+ status :
104
+ (conditions[?type == 'Complete']) :
105
+ - status : " True"
106
+ - delete :
107
+ ref :
108
+ apiVersion : batch/v1
109
+ kind : Job
110
+ name : folder-curl
111
+
112
+ - name : Delete Folder and verify it's removed in Grafana
113
+ try :
114
+ - delete :
115
+ ref :
116
+ apiVersion : grafana.integreatly.org/v1beta1
117
+ kind : GrafanaFolder
118
+ name : testdata
119
+
120
+ - apply : *curlJob
121
+
122
+ - assert :
123
+ resource :
124
+ apiVersion : batch/v1
125
+ kind : Job
126
+ metadata :
127
+ name : folder-curl
128
+ status :
129
+ (conditions[?type == 'Failed']) :
130
+ - status : " True"
You can’t perform that action at this time.
0 commit comments