Skip to content

Commit ff16da7

Browse files
committed
fix: apply gofmt to test files for CI compliance
Fix struct field alignment in test files to pass CI gofmt validation.
1 parent 81a363b commit ff16da7

2 files changed

Lines changed: 104 additions & 104 deletions

File tree

src/code.cloudfoundry.org/gorouter/handlers/mtls_route_policies_auth_test.go

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
6767
Context("when CallerIdentity is nil", func() {
6868
It("returns nil (identity check should have failed earlier)", func() {
6969
endpoint = route.NewEndpoint(&route.EndpointOpts{
70-
AppId: "backend-app",
71-
Host: "192.168.1.1",
72-
Port: 8080,
73-
RoutePolicyScope: route.RoutePolicyScopeOrg,
74-
RoutePolicies: []string{"cf:any"},
70+
AppId: "backend-app",
71+
Host: "192.168.1.1",
72+
Port: 8080,
73+
RoutePolicyScope: route.RoutePolicyScopeOrg,
74+
RoutePolicies: []string{"cf:any"},
7575
})
7676
pool = createPool(endpoint)
7777
reqInfo.RoutePool = pool
@@ -85,11 +85,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
8585
Context("when no route policies are configured", func() {
8686
It("denies with AuthError (default deny)", func() {
8787
endpoint = route.NewEndpoint(&route.EndpointOpts{
88-
AppId: "backend-app",
89-
Host: "192.168.1.1",
90-
Port: 8080,
91-
RoutePolicyScope: route.RoutePolicyScopeOrg,
92-
RoutePolicies: []string{}, // No sources = default deny
88+
AppId: "backend-app",
89+
Host: "192.168.1.1",
90+
Port: 8080,
91+
RoutePolicyScope: route.RoutePolicyScopeOrg,
92+
RoutePolicies: []string{}, // No sources = default deny
9393
})
9494
pool = createPool(endpoint)
9595
reqInfo.RoutePool = pool
@@ -113,11 +113,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
113113
Context("with route policy cf:any", func() {
114114
It("allows any authenticated caller", func() {
115115
endpoint = route.NewEndpoint(&route.EndpointOpts{
116-
AppId: "backend-app",
117-
Host: "192.168.1.1",
118-
Port: 8080,
119-
RoutePolicyScope: route.RoutePolicyScopeAny,
120-
RoutePolicies: []string{"cf:any"},
116+
AppId: "backend-app",
117+
Host: "192.168.1.1",
118+
Port: 8080,
119+
RoutePolicyScope: route.RoutePolicyScopeAny,
120+
RoutePolicies: []string{"cf:any"},
121121
})
122122
pool = createPool(endpoint)
123123
reqInfo.RoutePool = pool
@@ -136,11 +136,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
136136
Context("with route policy cf:app:<guid>", func() {
137137
It("allows caller with matching app GUID", func() {
138138
endpoint = route.NewEndpoint(&route.EndpointOpts{
139-
AppId: "backend-app",
140-
Host: "192.168.1.1",
141-
Port: 8080,
142-
RoutePolicyScope: route.RoutePolicyScopeAny,
143-
RoutePolicies: []string{"cf:app:allowed-app-123"},
139+
AppId: "backend-app",
140+
Host: "192.168.1.1",
141+
Port: 8080,
142+
RoutePolicyScope: route.RoutePolicyScopeAny,
143+
RoutePolicies: []string{"cf:app:allowed-app-123"},
144144
})
145145
pool = createPool(endpoint)
146146
reqInfo.RoutePool = pool
@@ -155,11 +155,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
155155

156156
It("denies caller with different app GUID", func() {
157157
endpoint = route.NewEndpoint(&route.EndpointOpts{
158-
AppId: "backend-app",
159-
Host: "192.168.1.1",
160-
Port: 8080,
161-
RoutePolicyScope: route.RoutePolicyScopeAny,
162-
RoutePolicies: []string{"cf:app:allowed-app-123"},
158+
AppId: "backend-app",
159+
Host: "192.168.1.1",
160+
Port: 8080,
161+
RoutePolicyScope: route.RoutePolicyScopeAny,
162+
RoutePolicies: []string{"cf:app:allowed-app-123"},
163163
})
164164
pool = createPool(endpoint)
165165
reqInfo.RoutePool = pool
@@ -182,11 +182,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
182182
Context("with route policy cf:space:<guid>", func() {
183183
It("allows caller from matching space", func() {
184184
endpoint = route.NewEndpoint(&route.EndpointOpts{
185-
AppId: "backend-app",
186-
Host: "192.168.1.1",
187-
Port: 8080,
188-
RoutePolicyScope: route.RoutePolicyScopeAny,
189-
RoutePolicies: []string{"cf:space:allowed-space-abc"},
185+
AppId: "backend-app",
186+
Host: "192.168.1.1",
187+
Port: 8080,
188+
RoutePolicyScope: route.RoutePolicyScopeAny,
189+
RoutePolicies: []string{"cf:space:allowed-space-abc"},
190190
})
191191
pool = createPool(endpoint)
192192
reqInfo.RoutePool = pool
@@ -202,11 +202,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
202202

203203
It("denies caller from different space", func() {
204204
endpoint = route.NewEndpoint(&route.EndpointOpts{
205-
AppId: "backend-app",
206-
Host: "192.168.1.1",
207-
Port: 8080,
208-
RoutePolicyScope: route.RoutePolicyScopeAny,
209-
RoutePolicies: []string{"cf:space:allowed-space-abc"},
205+
AppId: "backend-app",
206+
Host: "192.168.1.1",
207+
Port: 8080,
208+
RoutePolicyScope: route.RoutePolicyScopeAny,
209+
RoutePolicies: []string{"cf:space:allowed-space-abc"},
210210
})
211211
pool = createPool(endpoint)
212212
reqInfo.RoutePool = pool
@@ -229,11 +229,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
229229
Context("with route policy cf:org:<guid>", func() {
230230
It("allows caller from matching org", func() {
231231
endpoint = route.NewEndpoint(&route.EndpointOpts{
232-
AppId: "backend-app",
233-
Host: "192.168.1.1",
234-
Port: 8080,
235-
RoutePolicyScope: route.RoutePolicyScopeAny,
236-
RoutePolicies: []string{"cf:org:allowed-org-123"},
232+
AppId: "backend-app",
233+
Host: "192.168.1.1",
234+
Port: 8080,
235+
RoutePolicyScope: route.RoutePolicyScopeAny,
236+
RoutePolicies: []string{"cf:org:allowed-org-123"},
237237
})
238238
pool = createPool(endpoint)
239239
reqInfo.RoutePool = pool
@@ -249,11 +249,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
249249

250250
It("denies caller from different org", func() {
251251
endpoint = route.NewEndpoint(&route.EndpointOpts{
252-
AppId: "backend-app",
253-
Host: "192.168.1.1",
254-
Port: 8080,
255-
RoutePolicyScope: route.RoutePolicyScopeAny,
256-
RoutePolicies: []string{"cf:org:allowed-org-123"},
252+
AppId: "backend-app",
253+
Host: "192.168.1.1",
254+
Port: 8080,
255+
RoutePolicyScope: route.RoutePolicyScopeAny,
256+
RoutePolicies: []string{"cf:org:allowed-org-123"},
257257
})
258258
pool = createPool(endpoint)
259259
reqInfo.RoutePool = pool
@@ -377,11 +377,11 @@ var _ = Describe("MtlsRoutePoliciesAuth", func() {
377377
Context("edge cases", func() {
378378
It("handles whitespace in route policies", func() {
379379
endpoint = route.NewEndpoint(&route.EndpointOpts{
380-
AppId: "backend-app",
381-
Host: "192.168.1.1",
382-
Port: 8080,
383-
RoutePolicyScope: route.RoutePolicyScopeAny,
384-
RoutePolicies: []string{" cf:any "}, // Whitespace
380+
AppId: "backend-app",
381+
Host: "192.168.1.1",
382+
Port: 8080,
383+
RoutePolicyScope: route.RoutePolicyScopeAny,
384+
RoutePolicies: []string{" cf:any "}, // Whitespace
385385
})
386386
pool = createPool(endpoint)
387387
reqInfo.RoutePool = pool

src/code.cloudfoundry.org/gorouter/handlers/mtls_scope_auth_test.go

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ var _ = Describe("MtlsScopeAuth", func() {
7070
Context("when CallerIdentity is nil", func() {
7171
It("returns nil (identity check should have failed in pre-auth)", func() {
7272
endpoint = route.NewEndpoint(&route.EndpointOpts{
73-
AppId: "backend-app",
74-
Host: "192.168.1.1",
75-
Port: 8080,
73+
AppId: "backend-app",
74+
Host: "192.168.1.1",
75+
Port: 8080,
7676
RoutePolicyScope: route.RoutePolicyScopeOrg,
7777
})
7878
pool = createPool(endpoint)
@@ -89,9 +89,9 @@ var _ = Describe("MtlsScopeAuth", func() {
8989
Context("with scope=any", func() {
9090
It("allows any authenticated caller", func() {
9191
endpoint = route.NewEndpoint(&route.EndpointOpts{
92-
AppId: "backend-app",
93-
Host: "192.168.1.1",
94-
Port: 8080,
92+
AppId: "backend-app",
93+
Host: "192.168.1.1",
94+
Port: 8080,
9595
RoutePolicyScope: route.RoutePolicyScopeAny,
9696
})
9797
pool = createPool(endpoint)
@@ -110,10 +110,10 @@ var _ = Describe("MtlsScopeAuth", func() {
110110
Context("with scope=org", func() {
111111
It("allows caller from same org", func() {
112112
endpoint = route.NewEndpoint(&route.EndpointOpts{
113-
AppId: "backend-app",
114-
Host: "192.168.1.1",
115-
Port: 8080,
116-
Tags: map[string]string{"organization_id": "org-123"},
113+
AppId: "backend-app",
114+
Host: "192.168.1.1",
115+
Port: 8080,
116+
Tags: map[string]string{"organization_id": "org-123"},
117117
RoutePolicyScope: route.RoutePolicyScopeOrg,
118118
})
119119
pool = createPool(endpoint)
@@ -129,10 +129,10 @@ var _ = Describe("MtlsScopeAuth", func() {
129129

130130
It("denies caller from different org with AuthError", func() {
131131
endpoint = route.NewEndpoint(&route.EndpointOpts{
132-
AppId: "backend-app",
133-
Host: "192.168.1.1",
134-
Port: 8080,
135-
Tags: map[string]string{"organization_id": "org-123"},
132+
AppId: "backend-app",
133+
Host: "192.168.1.1",
134+
Port: 8080,
135+
Tags: map[string]string{"organization_id": "org-123"},
136136
RoutePolicyScope: route.RoutePolicyScopeOrg,
137137
})
138138
pool = createPool(endpoint)
@@ -154,10 +154,10 @@ var _ = Describe("MtlsScopeAuth", func() {
154154

155155
It("denies caller when endpoint has no organization_id tag", func() {
156156
endpoint = route.NewEndpoint(&route.EndpointOpts{
157-
AppId: "backend-app",
158-
Host: "192.168.1.1",
159-
Port: 8080,
160-
Tags: map[string]string{}, // No org tag
157+
AppId: "backend-app",
158+
Host: "192.168.1.1",
159+
Port: 8080,
160+
Tags: map[string]string{}, // No org tag
161161
RoutePolicyScope: route.RoutePolicyScopeOrg,
162162
})
163163
pool = createPool(endpoint)
@@ -178,10 +178,10 @@ var _ = Describe("MtlsScopeAuth", func() {
178178

179179
It("denies caller when caller has no org", func() {
180180
endpoint = route.NewEndpoint(&route.EndpointOpts{
181-
AppId: "backend-app",
182-
Host: "192.168.1.1",
183-
Port: 8080,
184-
Tags: map[string]string{"organization_id": "org-123"},
181+
AppId: "backend-app",
182+
Host: "192.168.1.1",
183+
Port: 8080,
184+
Tags: map[string]string{"organization_id": "org-123"},
185185
RoutePolicyScope: route.RoutePolicyScopeOrg,
186186
})
187187
pool = createPool(endpoint)
@@ -205,10 +205,10 @@ var _ = Describe("MtlsScopeAuth", func() {
205205
Context("with scope=space", func() {
206206
It("allows caller from same space", func() {
207207
endpoint = route.NewEndpoint(&route.EndpointOpts{
208-
AppId: "backend-app",
209-
Host: "192.168.1.1",
210-
Port: 8080,
211-
Tags: map[string]string{"space_id": "space-abc"},
208+
AppId: "backend-app",
209+
Host: "192.168.1.1",
210+
Port: 8080,
211+
Tags: map[string]string{"space_id": "space-abc"},
212212
RoutePolicyScope: route.RoutePolicyScopeSpace,
213213
})
214214
pool = createPool(endpoint)
@@ -224,10 +224,10 @@ var _ = Describe("MtlsScopeAuth", func() {
224224

225225
It("denies caller from different space with AuthError", func() {
226226
endpoint = route.NewEndpoint(&route.EndpointOpts{
227-
AppId: "backend-app",
228-
Host: "192.168.1.1",
229-
Port: 8080,
230-
Tags: map[string]string{"space_id": "space-abc"},
227+
AppId: "backend-app",
228+
Host: "192.168.1.1",
229+
Port: 8080,
230+
Tags: map[string]string{"space_id": "space-abc"},
231231
RoutePolicyScope: route.RoutePolicyScopeSpace,
232232
})
233233
pool = createPool(endpoint)
@@ -249,10 +249,10 @@ var _ = Describe("MtlsScopeAuth", func() {
249249

250250
It("denies caller when endpoint has no space_id tag", func() {
251251
endpoint = route.NewEndpoint(&route.EndpointOpts{
252-
AppId: "backend-app",
253-
Host: "192.168.1.1",
254-
Port: 8080,
255-
Tags: map[string]string{}, // No space tag
252+
AppId: "backend-app",
253+
Host: "192.168.1.1",
254+
Port: 8080,
255+
Tags: map[string]string{}, // No space tag
256256
RoutePolicyScope: route.RoutePolicyScopeSpace,
257257
})
258258
pool = createPool(endpoint)
@@ -272,10 +272,10 @@ var _ = Describe("MtlsScopeAuth", func() {
272272

273273
It("denies caller when caller has no space", func() {
274274
endpoint = route.NewEndpoint(&route.EndpointOpts{
275-
AppId: "backend-app",
276-
Host: "192.168.1.1",
277-
Port: 8080,
278-
Tags: map[string]string{"space_id": "space-abc"},
275+
AppId: "backend-app",
276+
Host: "192.168.1.1",
277+
Port: 8080,
278+
Tags: map[string]string{"space_id": "space-abc"},
279279
RoutePolicyScope: route.RoutePolicyScopeSpace,
280280
})
281281
pool = createPool(endpoint)
@@ -300,10 +300,10 @@ var _ = Describe("MtlsScopeAuth", func() {
300300
It("allows request when selected endpoint matches caller's space", func() {
301301
// Endpoint from space-abc
302302
endpoint = route.NewEndpoint(&route.EndpointOpts{
303-
AppId: "backend-app-1",
304-
Host: "192.168.1.1",
305-
Port: 8080,
306-
Tags: map[string]string{"space_id": "space-abc"},
303+
AppId: "backend-app-1",
304+
Host: "192.168.1.1",
305+
Port: 8080,
306+
Tags: map[string]string{"space_id": "space-abc"},
307307
RoutePolicyScope: route.RoutePolicyScopeSpace,
308308
})
309309

@@ -315,10 +315,10 @@ var _ = Describe("MtlsScopeAuth", func() {
315315

316316
// Another endpoint from space-xyz
317317
endpoint2 := route.NewEndpoint(&route.EndpointOpts{
318-
AppId: "backend-app-2",
319-
Host: "192.168.1.2",
320-
Port: 8080,
321-
Tags: map[string]string{"space_id": "space-xyz"},
318+
AppId: "backend-app-2",
319+
Host: "192.168.1.2",
320+
Port: 8080,
321+
Tags: map[string]string{"space_id": "space-xyz"},
322322
RoutePolicyScope: route.RoutePolicyScopeSpace,
323323
})
324324
pool.Put(endpoint2)
@@ -337,10 +337,10 @@ var _ = Describe("MtlsScopeAuth", func() {
337337
It("denies request when selected endpoint is from different space (intermittent 403)", func() {
338338
// Endpoint from space-xyz (will be selected)
339339
endpoint = route.NewEndpoint(&route.EndpointOpts{
340-
AppId: "backend-app-2",
341-
Host: "192.168.1.2",
342-
Port: 8080,
343-
Tags: map[string]string{"space_id": "space-xyz"},
340+
AppId: "backend-app-2",
341+
Host: "192.168.1.2",
342+
Port: 8080,
343+
Tags: map[string]string{"space_id": "space-xyz"},
344344
RoutePolicyScope: route.RoutePolicyScopeSpace,
345345
})
346346

@@ -351,10 +351,10 @@ var _ = Describe("MtlsScopeAuth", func() {
351351

352352
// Endpoint from space-abc
353353
endpoint1 := route.NewEndpoint(&route.EndpointOpts{
354-
AppId: "backend-app-1",
355-
Host: "192.168.1.1",
356-
Port: 8080,
357-
Tags: map[string]string{"space_id": "space-abc"},
354+
AppId: "backend-app-1",
355+
Host: "192.168.1.1",
356+
Port: 8080,
357+
Tags: map[string]string{"space_id": "space-abc"},
358358
RoutePolicyScope: route.RoutePolicyScopeSpace,
359359
})
360360
pool.Put(endpoint1)

0 commit comments

Comments
 (0)