@@ -93,6 +93,7 @@ var _ = Describe("ClientSettingsPolicy", Ordered, Label("functional", "cspolicy"
93
93
94
94
Context ("nginx config" , func () {
95
95
var conf * framework.Payload
96
+ filePrefix := fmt .Sprintf ("/etc/nginx/includes/ClientSettingsPolicy_%s" , namespace )
96
97
97
98
BeforeAll (func () {
98
99
podNames , err := framework .GetReadyNGFPodNames (k8sClient , ngfNamespace , releaseName , timeoutConfig .GetTimeout )
@@ -108,105 +109,96 @@ var _ = Describe("ClientSettingsPolicy", Ordered, Label("functional", "cspolicy"
108
109
DescribeTable ("is set properly for" ,
109
110
func (expCfgs []framework.ExpectedNginxField ) {
110
111
for _ , expCfg := range expCfgs {
111
- failureMsg := fmt .Sprintf (
112
- "directive '%s' with value '%s' not found in expected place" ,
113
- expCfg .Key , expCfg .Value ,
114
- )
115
- Expect (framework .ValidateNginxFieldExists (conf , expCfg )).To (BeTrue (), failureMsg )
112
+ Expect (framework .ValidateNginxFieldExists (conf , expCfg )).To (Succeed ())
116
113
}
117
114
},
118
115
Entry ("gateway policy" , []framework.ExpectedNginxField {
119
116
{
120
- Key : "include" ,
121
- Value : "gw-csp.conf" ,
122
- ValueSubstringAllowed : true ,
123
- File : "http.conf" ,
124
- Servers : []string {"*.example.com" , "cafe.example.com" },
117
+ Directive : "include" ,
118
+ Value : fmt .Sprintf ("%s_gw-csp.conf" , filePrefix ),
119
+ File : "http.conf" ,
120
+ Servers : []string {"*.example.com" , "cafe.example.com" },
125
121
},
126
122
{
127
- Key : "client_max_body_size" ,
128
- Value : "1000" ,
129
- File : "gw -csp.conf" ,
123
+ Directive : "client_max_body_size" ,
124
+ Value : "1000" ,
125
+ File : fmt . Sprintf ( "%s_gw -csp.conf", filePrefix ) ,
130
126
},
131
127
{
132
- Key : "client_body_timeout" ,
133
- Value : "30s" ,
134
- File : "gw -csp.conf" ,
128
+ Directive : "client_body_timeout" ,
129
+ Value : "30s" ,
130
+ File : fmt . Sprintf ( "%s_gw -csp.conf", filePrefix ) ,
135
131
},
136
132
{
137
- Key : "keepalive_requests" ,
138
- Value : "100" ,
139
- File : "gw -csp.conf" ,
133
+ Directive : "keepalive_requests" ,
134
+ Value : "100" ,
135
+ File : fmt . Sprintf ( "%s_gw -csp.conf", filePrefix ) ,
140
136
},
141
137
{
142
- Key : "keepalive_time" ,
143
- Value : "5s" ,
144
- File : "gw -csp.conf" ,
138
+ Directive : "keepalive_time" ,
139
+ Value : "5s" ,
140
+ File : fmt . Sprintf ( "%s_gw -csp.conf", filePrefix ) ,
145
141
},
146
142
{
147
- Key : "keepalive_timeout" ,
148
- Value : "2s 1s" ,
149
- File : "gw -csp.conf" ,
143
+ Directive : "keepalive_timeout" ,
144
+ Value : "2s 1s" ,
145
+ File : fmt . Sprintf ( "%s_gw -csp.conf", filePrefix ) ,
150
146
},
151
147
}),
152
148
Entry ("coffee route policy" , []framework.ExpectedNginxField {
153
149
{
154
- Key : "include" ,
155
- Value : "coffee-route-csp.conf" ,
156
- ValueSubstringAllowed : true ,
157
- File : "http.conf" ,
158
- Servers : []string {"cafe.example.com" },
159
- Location : "/coffee" ,
150
+ Directive : "include" ,
151
+ Value : fmt .Sprintf ("%s_coffee-route-csp.conf" , filePrefix ),
152
+ File : "http.conf" ,
153
+ Servers : []string {"cafe.example.com" },
154
+ Location : "/coffee" ,
160
155
},
161
156
{
162
- Key : "client_max_body_size" ,
163
- Value : "2000" ,
164
- File : "coffee -route-csp.conf" ,
157
+ Directive : "client_max_body_size" ,
158
+ Value : "2000" ,
159
+ File : fmt . Sprintf ( "%s_coffee -route-csp.conf", filePrefix ) ,
165
160
},
166
161
}),
167
162
Entry ("tea route policy" , []framework.ExpectedNginxField {
168
163
{
169
- Key : "include" ,
170
- Value : "tea-route-csp.conf" ,
171
- ValueSubstringAllowed : true ,
172
- File : "http.conf" ,
173
- Servers : []string {"cafe.example.com" },
174
- Location : "/tea" ,
164
+ Directive : "include" ,
165
+ Value : fmt .Sprintf ("%s_tea-route-csp.conf" , filePrefix ),
166
+ File : "http.conf" ,
167
+ Servers : []string {"cafe.example.com" },
168
+ Location : "/tea" ,
175
169
},
176
170
{
177
- Key : "keepalive_requests" ,
178
- Value : "200" ,
179
- File : "tea -route-csp.conf" ,
171
+ Directive : "keepalive_requests" ,
172
+ Value : "200" ,
173
+ File : fmt . Sprintf ( "%s_tea -route-csp.conf", filePrefix ) ,
180
174
},
181
175
}),
182
176
Entry ("soda route policy" , []framework.ExpectedNginxField {
183
177
{
184
- Key : "include" ,
185
- Value : "soda-route-csp.conf" ,
186
- ValueSubstringAllowed : true ,
187
- File : "http.conf" ,
188
- Servers : []string {"cafe.example.com" },
189
- Location : "/soda" ,
178
+ Directive : "include" ,
179
+ Value : fmt .Sprintf ("%s_soda-route-csp.conf" , filePrefix ),
180
+ File : "http.conf" ,
181
+ Servers : []string {"cafe.example.com" },
182
+ Location : "/soda" ,
190
183
},
191
184
{
192
- Key : "client_max_body_size" ,
193
- Value : "3000" ,
194
- File : "soda -route-csp.conf" ,
185
+ Directive : "client_max_body_size" ,
186
+ Value : "3000" ,
187
+ File : fmt . Sprintf ( "%s_soda -route-csp.conf", filePrefix ) ,
195
188
},
196
189
}),
197
190
Entry ("grpc route policy" , []framework.ExpectedNginxField {
198
191
{
199
- Key : "include" ,
200
- Value : "grpc-route-csp.conf" ,
201
- ValueSubstringAllowed : true ,
202
- File : "http.conf" ,
203
- Servers : []string {"*.example.com" },
204
- Location : "/helloworld.Greeter/SayHello" ,
192
+ Directive : "include" ,
193
+ Value : fmt .Sprintf ("%s_grpc-route-csp.conf" , filePrefix ),
194
+ File : "http.conf" ,
195
+ Servers : []string {"*.example.com" },
196
+ Location : "/helloworld.Greeter/SayHello" ,
205
197
},
206
198
{
207
- Key : "client_max_body_size" ,
208
- Value : "0" ,
209
- File : "grpc -route-csp.conf" ,
199
+ Directive : "client_max_body_size" ,
200
+ Value : "0" ,
201
+ File : fmt . Sprintf ( "%s_grpc -route-csp.conf", filePrefix ) ,
210
202
},
211
203
}),
212
204
)
0 commit comments