@@ -39,7 +39,7 @@ func TestBasicPathsMerged(t *testing.T) {
39
39
SwaggerProps : spec.SwaggerProps {
40
40
Paths : & spec.Paths {
41
41
Paths : map [string ]spec.PathItem {
42
- "/apis/foo/v1" : {},
42
+ "/apis/foo/v1/ " : {},
43
43
},
44
44
},
45
45
},
@@ -52,8 +52,8 @@ func TestBasicPathsMerged(t *testing.T) {
52
52
if err != nil {
53
53
t .Error (err )
54
54
}
55
- expectPath (t , swagger , "/apis/foo/v1" )
56
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
55
+ expectPath (t , swagger , "/apis/foo/v1/ " )
56
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
57
57
}
58
58
59
59
func TestAddUpdateAPIService (t * testing.T ) {
@@ -103,7 +103,7 @@ func TestAddUpdateAPIService(t *testing.T) {
103
103
}
104
104
105
105
expectPath (t , swagger , "/apis/apiservicegroup/v1/path1" )
106
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
106
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
107
107
108
108
t .Log ("Update APIService OpenAPI" )
109
109
handler .openapi = & spec.Swagger {
@@ -127,7 +127,7 @@ func TestAddUpdateAPIService(t *testing.T) {
127
127
// aggregated OpenAPI is also updated.
128
128
expectPath (t , swagger , "/apis/apiservicegroup/v1/path2" )
129
129
expectNoPath (t , swagger , "/apis/apiservicegroup/v1/path1" )
130
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
130
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
131
131
}
132
132
133
133
// Tests that an APIService that registers OpenAPI will only have the OpenAPI
@@ -140,7 +140,7 @@ func TestAPIServiceOpenAPIServiceMismatch(t *testing.T) {
140
140
SwaggerProps : spec.SwaggerProps {
141
141
Paths : & spec.Paths {
142
142
Paths : map [string ]spec.PathItem {
143
- "/apis/foo/v1" : {},
143
+ "/apis/foo/v1/ " : {},
144
144
},
145
145
},
146
146
},
@@ -171,7 +171,8 @@ func TestAPIServiceOpenAPIServiceMismatch(t *testing.T) {
171
171
SwaggerProps : spec.SwaggerProps {
172
172
Paths : & spec.Paths {
173
173
Paths : map [string ]spec.PathItem {
174
- "/apis/apiservicegroup/v1" : {},
174
+ "/apis/apiservicegroup/v1/" : {},
175
+ "/apis/apiservicegroup/v1beta1/" : {},
175
176
},
176
177
},
177
178
},
@@ -181,9 +182,9 @@ func TestAPIServiceOpenAPIServiceMismatch(t *testing.T) {
181
182
SwaggerProps : spec.SwaggerProps {
182
183
Paths : & spec.Paths {
183
184
Paths : map [string ]spec.PathItem {
184
- "/apis/a" : {},
185
- "/apis/apiservicegroup/v1" : {},
186
- "/apis/apiservicegroup/v2" : {},
185
+ "/apis/a/ " : {},
186
+ "/apis/apiservicegroup/v1/ " : {},
187
+ "/apis/apiservicegroup/v2/ " : {},
187
188
},
188
189
},
189
190
},
@@ -207,10 +208,11 @@ func TestAPIServiceOpenAPIServiceMismatch(t *testing.T) {
207
208
if err != nil {
208
209
t .Error (err )
209
210
}
210
- expectPath (t , swagger , "/apis/apiservicegroup/v1" )
211
- expectPath (t , swagger , "/apis/apiservicegroup/v2" )
212
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
213
- expectNoPath (t , swagger , "/apis/a" )
211
+ expectPath (t , swagger , "/apis/apiservicegroup/v1/" )
212
+ expectPath (t , swagger , "/apis/apiservicegroup/v2/" )
213
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/" )
214
+ expectNoPath (t , swagger , "/apis/a/" )
215
+ expectNoPath (t , swagger , "/apis/apiservicegroup/v1beta1/" )
214
216
215
217
t .Logf ("Remove APIService %s" , apiService .Name )
216
218
s .RemoveAPIService (apiService .Name )
@@ -221,7 +223,7 @@ func TestAPIServiceOpenAPIServiceMismatch(t *testing.T) {
221
223
}
222
224
// Ensure that the if the APIService is added then removed, the OpenAPI disappears from the aggregated OpenAPI as well.
223
225
expectNoPath (t , swagger , "/apis/apiservicegroup/v1" )
224
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
226
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
225
227
expectNoPath (t , swagger , "/apis/a" )
226
228
}
227
229
@@ -232,7 +234,7 @@ func TestAddRemoveAPIService(t *testing.T) {
232
234
SwaggerProps : spec.SwaggerProps {
233
235
Paths : & spec.Paths {
234
236
Paths : map [string ]spec.PathItem {
235
- "/apis/foo/v1" : {},
237
+ "/apis/foo/v1/ " : {},
236
238
},
237
239
},
238
240
},
@@ -254,7 +256,7 @@ func TestAddRemoveAPIService(t *testing.T) {
254
256
SwaggerProps : spec.SwaggerProps {
255
257
Paths : & spec.Paths {
256
258
Paths : map [string ]spec.PathItem {
257
- "/apis/apiservicegroup/v1" : {},
259
+ "/apis/apiservicegroup/v1/ " : {},
258
260
},
259
261
},
260
262
},
@@ -271,8 +273,8 @@ func TestAddRemoveAPIService(t *testing.T) {
271
273
if err != nil {
272
274
t .Error (err )
273
275
}
274
- expectPath (t , swagger , "/apis/apiservicegroup/v1" )
275
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
276
+ expectPath (t , swagger , "/apis/apiservicegroup/v1/ " )
277
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
276
278
277
279
t .Logf ("Remove APIService %s" , apiService .Name )
278
280
s .RemoveAPIService (apiService .Name )
@@ -282,8 +284,8 @@ func TestAddRemoveAPIService(t *testing.T) {
282
284
t .Error (err )
283
285
}
284
286
// Ensure that the if the APIService is added then removed, the OpenAPI disappears from the aggregated OpenAPI as well.
285
- expectNoPath (t , swagger , "/apis/apiservicegroup/v1" )
286
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
287
+ expectNoPath (t , swagger , "/apis/apiservicegroup/v1/ " )
288
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
287
289
}
288
290
289
291
func TestUpdateAPIService (t * testing.T ) {
@@ -293,7 +295,7 @@ func TestUpdateAPIService(t *testing.T) {
293
295
SwaggerProps : spec.SwaggerProps {
294
296
Paths : & spec.Paths {
295
297
Paths : map [string ]spec.PathItem {
296
- "/apis/foo/v1" : {},
298
+ "/apis/foo/v1/ " : {},
297
299
},
298
300
},
299
301
},
@@ -315,7 +317,7 @@ func TestUpdateAPIService(t *testing.T) {
315
317
SwaggerProps : spec.SwaggerProps {
316
318
Paths : & spec.Paths {
317
319
Paths : map [string ]spec.PathItem {
318
- "/apis/apiservicegroup/v1" : {},
320
+ "/apis/apiservicegroup/v1/ " : {},
319
321
},
320
322
},
321
323
},
@@ -340,8 +342,8 @@ func TestUpdateAPIService(t *testing.T) {
340
342
if err != nil {
341
343
t .Error (err )
342
344
}
343
- expectPath (t , swagger , "/apis/apiservicegroup/v1" )
344
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
345
+ expectPath (t , swagger , "/apis/apiservicegroup/v1/ " )
346
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
345
347
346
348
t .Logf ("Updating APIService %s" , apiService .Name )
347
349
if err := s .AddUpdateAPIService (apiService , handler2 ); err != nil {
@@ -356,8 +358,8 @@ func TestUpdateAPIService(t *testing.T) {
356
358
t .Error (err )
357
359
}
358
360
// Ensure that the if the APIService is added and then handler is modified, the new data is reflected in the aggregated OpenAPI.
359
- expectNoPath (t , swagger , "/apis/apiservicegroup/v1" )
360
- expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1" )
361
+ expectNoPath (t , swagger , "/apis/apiservicegroup/v1/ " )
362
+ expectPath (t , swagger , "/apis/apiregistration.k8s.io/v1/ " )
361
363
}
362
364
363
365
func TestFailingAPIServiceSkippedAggregation (t * testing.T ) {
@@ -367,7 +369,7 @@ func TestFailingAPIServiceSkippedAggregation(t *testing.T) {
367
369
SwaggerProps : spec.SwaggerProps {
368
370
Paths : & spec.Paths {
369
371
Paths : map [string ]spec.PathItem {
370
- "/apis/foo/v1" : {},
372
+ "/apis/foo/v1/ " : {},
371
373
},
372
374
},
373
375
},
@@ -391,7 +393,7 @@ func TestFailingAPIServiceSkippedAggregation(t *testing.T) {
391
393
SwaggerProps : spec.SwaggerProps {
392
394
Paths : & spec.Paths {
393
395
Paths : map [string ]spec.PathItem {
394
- "/apis/failed/v1" : {},
396
+ "/apis/failed/v1/ " : {},
395
397
},
396
398
},
397
399
},
@@ -412,7 +414,7 @@ func TestFailingAPIServiceSkippedAggregation(t *testing.T) {
412
414
SwaggerProps : spec.SwaggerProps {
413
415
Paths : & spec.Paths {
414
416
Paths : map [string ]spec.PathItem {
415
- "/apis/success/v1" : {},
417
+ "/apis/success/v1/ " : {},
416
418
},
417
419
},
418
420
},
@@ -437,9 +439,9 @@ func TestFailingAPIServiceSkippedAggregation(t *testing.T) {
437
439
if err != nil {
438
440
t .Error (err )
439
441
}
440
- expectPath (t , swagger , "/apis/foo/v1" )
441
- expectNoPath (t , swagger , "/apis/failed/v1" )
442
- expectPath (t , swagger , "/apis/success/v1" )
442
+ expectPath (t , swagger , "/apis/foo/v1/ " )
443
+ expectNoPath (t , swagger , "/apis/failed/v1/ " )
444
+ expectPath (t , swagger , "/apis/success/v1/ " )
443
445
}
444
446
445
447
func TestAPIServiceFailSuccessTransition (t * testing.T ) {
@@ -449,7 +451,7 @@ func TestAPIServiceFailSuccessTransition(t *testing.T) {
449
451
SwaggerProps : spec.SwaggerProps {
450
452
Paths : & spec.Paths {
451
453
Paths : map [string ]spec.PathItem {
452
- "/apis/foo/v1" : {},
454
+ "/apis/foo/v1/ " : {},
453
455
},
454
456
},
455
457
},
@@ -473,7 +475,7 @@ func TestAPIServiceFailSuccessTransition(t *testing.T) {
473
475
SwaggerProps : spec.SwaggerProps {
474
476
Paths : & spec.Paths {
475
477
Paths : map [string ]spec.PathItem {
476
- "/apis/apiservicegroup/v1" : {},
478
+ "/apis/apiservicegroup/v1/ " : {},
477
479
},
478
480
},
479
481
},
@@ -491,8 +493,8 @@ func TestAPIServiceFailSuccessTransition(t *testing.T) {
491
493
if err != nil {
492
494
t .Error (err )
493
495
}
494
- expectPath (t , swagger , "/apis/foo/v1" )
495
- expectNoPath (t , swagger , "/apis/apiservicegroup/v1" )
496
+ expectPath (t , swagger , "/apis/foo/v1/ " )
497
+ expectNoPath (t , swagger , "/apis/apiservicegroup/v1/ " )
496
498
497
499
t .Log ("Transition APIService to not return error" )
498
500
handler .returnErr = false
@@ -504,8 +506,8 @@ func TestAPIServiceFailSuccessTransition(t *testing.T) {
504
506
if err != nil {
505
507
t .Error (err )
506
508
}
507
- expectPath (t , swagger , "/apis/foo/v1" )
508
- expectPath (t , swagger , "/apis/apiservicegroup/v1" )
509
+ expectPath (t , swagger , "/apis/foo/v1/ " )
510
+ expectPath (t , swagger , "/apis/apiservicegroup/v1/ " )
509
511
}
510
512
511
513
func TestFailingAPIServiceDoesNotBlockAdd (t * testing.T ) {
@@ -515,7 +517,7 @@ func TestFailingAPIServiceDoesNotBlockAdd(t *testing.T) {
515
517
SwaggerProps : spec.SwaggerProps {
516
518
Paths : & spec.Paths {
517
519
Paths : map [string ]spec.PathItem {
518
- "/apis/foo/v1" : {},
520
+ "/apis/foo/v1/ " : {},
519
521
},
520
522
},
521
523
},
@@ -542,7 +544,7 @@ func TestFailingAPIServiceDoesNotBlockAdd(t *testing.T) {
542
544
SwaggerProps : spec.SwaggerProps {
543
545
Paths : & spec.Paths {
544
546
Paths : map [string ]spec.PathItem {
545
- "/apis/failed/v1" : {},
547
+ "/apis/failed/v1/ " : {},
546
548
},
547
549
},
548
550
},
@@ -567,8 +569,8 @@ func TestFailingAPIServiceDoesNotBlockAdd(t *testing.T) {
567
569
if err != nil {
568
570
t .Error (err )
569
571
}
570
- expectPath (t , swagger , "/apis/foo/v1" )
571
- expectNoPath (t , swagger , "/apis/failed/v1" )
572
+ expectPath (t , swagger , "/apis/foo/v1/ " )
573
+ expectNoPath (t , swagger , "/apis/failed/v1/ " )
572
574
}
573
575
574
576
type openAPIHandler struct {
@@ -619,7 +621,7 @@ func buildAndRegisterSpecAggregator(delegationHandlers []http.Handler, mux commo
619
621
SwaggerProps : spec.SwaggerProps {
620
622
Paths : & spec.Paths {
621
623
Paths : map [string ]spec.PathItem {
622
- "/apis/apiregistration.k8s.io/v1" : {},
624
+ "/apis/apiregistration.k8s.io/v1/ " : {},
623
625
},
624
626
},
625
627
},
0 commit comments