...
1apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2name: "[Stable] Console"
3crd: 0000_70_console-operator.crd.yaml
4tests:
5 onCreate:
6 - name: Should be able to create a minimal Console
7 initial: |
8 apiVersion: operator.openshift.io/v1
9 kind: Console
10 spec: {} # No spec is required for a Console
11 expected: |
12 apiVersion: operator.openshift.io/v1
13 kind: Console
14 spec:
15 logLevel: Normal
16 operatorLogLevel: Normal
17 - name: Should be able to customize perspectives
18 initial: |
19 apiVersion: operator.openshift.io/v1
20 kind: Console
21 spec:
22 customization:
23 perspectives:
24 - id: dev
25 visibility:
26 state: Enabled
27 - id: admin
28 visibility:
29 state: Disabled
30 expected: |
31 apiVersion: operator.openshift.io/v1
32 kind: Console
33 spec:
34 logLevel: Normal
35 operatorLogLevel: Normal
36 customization:
37 perspectives:
38 - id: dev
39 visibility:
40 state: Enabled
41 - id: admin
42 visibility:
43 state: Disabled
44 - name: Should throw an error for incorrect value of state in perspectives
45 initial: |
46 apiVersion: operator.openshift.io/v1
47 kind: Console
48 spec:
49 customization:
50 perspectives:
51 - id: dev
52 visibility:
53 state: Enables
54 expectedError: "spec.customization.perspectives[0].visibility.state: Unsupported value: \"Enables\": supported values: \"Enabled\", \"Disabled\", \"AccessReview\""
55 - name: Should be able to add pinned resources to a perspective
56 initial: |
57 apiVersion: operator.openshift.io/v1
58 kind: Console
59 spec:
60 customization:
61 perspectives:
62 - id: dev
63 visibility:
64 state: Enabled
65 pinnedResources:
66 - group: ""
67 resource: configmaps
68 version: v1
69 expected: |
70 apiVersion: operator.openshift.io/v1
71 kind: Console
72 spec:
73 logLevel: Normal
74 operatorLogLevel: Normal
75 customization:
76 perspectives:
77 - id: dev
78 visibility:
79 state: Enabled
80 pinnedResources:
81 - group: ""
82 resource: configmaps
83 version: v1
84 - name: Should not be able to add pinned resources to "admin" perspective
85 initial: |
86 apiVersion: operator.openshift.io/v1
87 kind: Console
88 spec:
89 customization:
90 perspectives:
91 - id: admin
92 visibility:
93 state: Enabled
94 pinnedResources:
95 - group: ""
96 resource: configmaps
97 version: v1
98 expectedError: "pinnedResources is allowed only for dev and forbidden for other perspectives"
99 - name: Should throw an error if "group" is missing from the pinnedResources
100 initial: |
101 apiVersion: operator.openshift.io/v1
102 kind: Console
103 spec:
104 customization:
105 perspectives:
106 - id: dev
107 visibility:
108 state: Enabled
109 pinnedResources:
110 - resource: configmaps
111 version: v1
112 expectedError: "spec.customization.perspectives[0].pinnedResources[0].group: Required value"
113 - name: Should throw an error if the value of "version" in the pinnedResources doesnot match the required regex
114 initial: |
115 apiVersion: operator.openshift.io/v1
116 kind: Console
117 spec:
118 customization:
119 perspectives:
120 - id: dev
121 visibility:
122 state: Enabled
123 pinnedResources:
124 - group: ""
125 resource: configmaps
126 version: v'
127 expectedError: "spec.customization.perspectives[0].pinnedResources[0].version in body should match '^[a-z0-9]+$'"
128 - name: Should throw an error if the value of "group" in the pinnedResources doesnot match the required regex
129 initial: |
130 apiVersion: operator.openshift.io/v1
131 kind: Console
132 spec:
133 customization:
134 perspectives:
135 - id: dev
136 visibility:
137 state: Enabled
138 pinnedResources:
139 - group: .apps.
140 resource: deployments
141 version: v1
142 expectedError: "spec.customization.perspectives[0].pinnedResources[0].group in body should match '^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'"
143 - name: Should throw an error if the value of "resource" in the pinnedResources doesnot match the required regex
144 initial: |
145 apiVersion: operator.openshift.io/v1
146 kind: Console
147 spec:
148 customization:
149 perspectives:
150 - id: dev
151 visibility:
152 state: Enabled
153 pinnedResources:
154 - group: apps
155 resource: Deployment
156 version: v1
157 expectedError: "spec.customization.perspectives[0].pinnedResources[0].resource in body should match '^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'"
View as plain text