MCPcopy
hub / github.com/gofiber/fiber / Test_App_Remove_Route_Concurrent

Function Test_App_Remove_Route_Concurrent

router_test.go:1201–1225  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1199}
1200
1201func Test_App_Remove_Route_Concurrent(t *testing.T) {
1202 t.Parallel()
1203 app := New()
1204
1205 // Add test route
1206 app.Get("/test", func(c Ctx) error {
1207 return c.SendStatus(StatusOK)
1208 })
1209
1210 // Concurrently remove and add routes
1211 var wg sync.WaitGroup
1212 for range 10 {
1213 wg.Go(func() {
1214 app.RemoveRoute("/test", MethodGet)
1215 app.Get("/test", func(c Ctx) error {
1216 return c.SendStatus(StatusOK)
1217 })
1218 })
1219 }
1220 wg.Wait()
1221
1222 // Verify final state
1223 app.RebuildTree()
1224 verifyRequest(t, app, "/test", StatusOK)
1225}
1226
1227func Test_Route_Registration_Prevent_Duplicate_With_Middleware(t *testing.T) {
1228 t.Parallel()

Callers

nothing calls this directly

Calls 6

verifyRequestFunction · 0.85
RemoveRouteMethod · 0.80
RebuildTreeMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
SendStatusMethod · 0.65

Tested by

no test coverage detected