Skip to content

Commit d9eefe9

Browse files
committed
Add tests for aws resource tags
Adds tests for the existing aws resource tags feature.
1 parent e4c9a17 commit d9eefe9

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "Infrastructure"
3+
crdName: infrastructures.config.openshift.io
4+
tests:
5+
# onCreate:
6+
# - name: Should be able to create an aws resourcetag with spaces
7+
# initial: |
8+
# apiVersion: config.openshift.io/v1
9+
# kind: Infrastructure
10+
# spec:
11+
# platformSpec:
12+
# aws: {}
13+
# type: AWS
14+
# status:
15+
# controlPlaneTopology: HighlyAvailable
16+
# cpuPartitioning: None
17+
# infrastructureTopology: HighlyAvailable
18+
# platform: AWS
19+
# platformStatus:
20+
# aws:
21+
# cloudLoadBalancerConfig:
22+
# dnsType: PlatformDefault
23+
# region: us-east-1
24+
# resourceTags:
25+
# - key: key with space
26+
# value: value with space
27+
# type: AWS
28+
# expected: |
29+
# apiVersion: config.openshift.io/v1
30+
# kind: Infrastructure
31+
# spec:
32+
# platformSpec:
33+
# type: AWS
34+
# aws: {}
35+
# status:
36+
# controlPlaneTopology: HighlyAvailable
37+
# cpuPartitioning: None
38+
# infrastructureTopology: HighlyAvailable
39+
# platform: AWS
40+
# platformStatus:
41+
# aws:
42+
# cloudLoadBalancerConfig:
43+
# dnsType: PlatformDefault
44+
# region: us-east-1
45+
# resourceTags:
46+
# - key: key with space
47+
# value: value with space
48+
# type: AWS
49+
# - name: Should not be able to create an aws resourcetag with aws prefix in key
50+
# initial: |
51+
# apiVersion: config.openshift.io/v1
52+
# kind: Infrastructure
53+
# spec:
54+
# platformSpec:
55+
# aws: {}
56+
# type: AWS
57+
# status:
58+
# controlPlaneTopology: HighlyAvailable
59+
# cpuPartitioning: None
60+
# infrastructureTopology: HighlyAvailable
61+
# platform: AWS
62+
# platformStatus:
63+
# aws:
64+
# cloudLoadBalancerConfig:
65+
# dnsType: PlatformDefault
66+
# region: us-east-1
67+
# resourceTags:
68+
# - key: mykey
69+
# value: value with space
70+
# type: AWS
71+
# expectedError: "the prefix 'aws:' is reserved for AWS system usage and cannot be used at the beginning of a key"
72+
onUpdate:
73+
- name: Should be able to create an aws resourcetag with spaces
74+
initial: |
75+
apiVersion: config.openshift.io/v1
76+
kind: Infrastructure
77+
spec:
78+
platformSpec:
79+
aws: {}
80+
type: AWS
81+
status:
82+
controlPlaneTopology: HighlyAvailable
83+
cpuPartitioning: None
84+
infrastructureTopology: HighlyAvailable
85+
platform: AWS
86+
platformStatus:
87+
aws:
88+
cloudLoadBalancerConfig:
89+
dnsType: PlatformDefault
90+
region: us-east-1
91+
resourceTags:
92+
- key: key with space
93+
value: value with space
94+
type: AWS
95+
updated: |
96+
apiVersion: config.openshift.io/v1
97+
kind: Infrastructure
98+
spec:
99+
platformSpec:
100+
type: AWS
101+
aws: {}
102+
status:
103+
controlPlaneTopology: HighlyAvailable
104+
cpuPartitioning: None
105+
infrastructureTopology: HighlyAvailable
106+
platform: AWS
107+
platformStatus:
108+
aws:
109+
cloudLoadBalancerConfig:
110+
dnsType: PlatformDefault
111+
region: us-east-1
112+
resourceTags:
113+
- key: key with space
114+
value: value with space
115+
type: AWS
116+
expected: |
117+
apiVersion: config.openshift.io/v1
118+
kind: Infrastructure
119+
spec:
120+
platformSpec:
121+
type: AWS
122+
aws: {}
123+
status:
124+
controlPlaneTopology: HighlyAvailable
125+
cpuPartitioning: None
126+
infrastructureTopology: HighlyAvailable
127+
platform: AWS
128+
platformStatus:
129+
aws:
130+
cloudLoadBalancerConfig:
131+
dnsType: PlatformDefault
132+
region: us-east-1
133+
resourceTags:
134+
- key: key with space
135+
value: value with space
136+
type: AWS
137+
# - name: Should not be able to create an aws resourcetag with aws prefix in key
138+
# initial: |
139+
# apiVersion: config.openshift.io/v1
140+
# kind: Infrastructure
141+
# spec:
142+
# platformSpec:
143+
# aws: {}
144+
# type: AWS
145+
# status:
146+
# controlPlaneTopology: HighlyAvailable
147+
# cpuPartitioning: None
148+
# infrastructureTopology: HighlyAvailable
149+
# platform: AWS
150+
# platformStatus:
151+
# aws:
152+
# cloudLoadBalancerConfig:
153+
# dnsType: PlatformDefault
154+
# region: us-east-1
155+
# resourceTags:
156+
# - key: aws:key
157+
# value: value with space
158+
# type: AWS
159+
# updated: |
160+
# apiVersion: config.openshift.io/v1
161+
# kind: Infrastructure
162+
# spec:
163+
# platformSpec:
164+
# aws: {}
165+
# type: AWS
166+
# status:
167+
# controlPlaneTopology: HighlyAvailable
168+
# cpuPartitioning: None
169+
# infrastructureTopology: HighlyAvailable
170+
# platform: AWS
171+
# platformStatus:
172+
# aws:
173+
# cloudLoadBalancerConfig:
174+
# dnsType: PlatformDefault
175+
# region: us-east-1
176+
# resourceTags:
177+
# - key: aws:key
178+
# value: value with space
179+
# type: AWS
180+
# expectedError: "the prefix 'aws:' is reserved for AWS system usage and cannot be used at the beginning of a key"

0 commit comments

Comments
 (0)