(b *testing.B)
| 109 | } |
| 110 | |
| 111 | func BenchmarkEntrypoint(b *testing.B) { |
| 112 | ep := NewTestEntrypoint(b, nil) |
| 113 | req := http.Request{ |
| 114 | Method: http.MethodGet, |
| 115 | URL: &url.URL{Path: "/", RawPath: "/"}, |
| 116 | Host: "test.domain.tld", |
| 117 | } |
| 118 | ep.SetFindRouteDomains([]string{}) |
| 119 | |
| 120 | r, err := route.NewStartedTestRoute(b, &route.Route{ |
| 121 | Alias: "test", |
| 122 | Scheme: routeTypes.SchemeHTTP, |
| 123 | Host: "localhost", |
| 124 | Port: route.Port{ |
| 125 | Listening: 18080, |
| 126 | Proxy: 8080, |
| 127 | }, |
| 128 | HealthCheck: types.HealthCheckConfig{ |
| 129 | Disable: true, |
| 130 | }, |
| 131 | }) |
| 132 | |
| 133 | require.NoError(b, err) |
| 134 | require.False(b, r.ShouldExclude()) |
| 135 | |
| 136 | r.(types.ReverseProxyRoute).ReverseProxy().Transport = noopTransport{} |
| 137 | |
| 138 | var w noopResponseWriter |
| 139 | |
| 140 | server, ok := ep.GetServer(":18080") |
| 141 | if !ok { |
| 142 | b.Fatal("server not found") |
| 143 | } |
| 144 | |
| 145 | b.ResetTimer() |
| 146 | for b.Loop() { |
| 147 | server.ServeHTTP(&w, &req) |
| 148 | if w.statusCode != http.StatusOK { |
| 149 | b.Fatalf("status code is not 200: %d", w.statusCode) |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | func benchmarkFindRoute(b *testing.B, aliases []string, host string) { |
| 155 | ep := NewTestEntrypoint(b, nil) |
nothing calls this directly
no test coverage detected