(t *testing.T)
| 931 | } |
| 932 | |
| 933 | func TestReverseProxy_ServeHTTPConcurrent(t *testing.T) { |
| 934 | addr, err := url.Parse(fakeServer.URL) |
| 935 | if err != nil { |
| 936 | t.Fatalf("unexpected error: %s", err) |
| 937 | } |
| 938 | goodCfg.Clusters[0].Nodes = []string{addr.Host} |
| 939 | proxy, err := newConfiguredProxy(goodCfg) |
| 940 | if err != nil { |
| 941 | t.Fatalf("unexpected error: %s", err) |
| 942 | } |
| 943 | t.Run("parallel requests", func(t *testing.T) { |
| 944 | f := func() { |
| 945 | req := httptest.NewRequest("GET", fmt.Sprintf("%s/fast", fakeServer.URL), nil) |
| 946 | makeCustomRequest(proxy, req) |
| 947 | } |
| 948 | if err := testConcurrent(f, 500); err != nil { |
| 949 | t.Fatalf("concurrent test err: %s", err) |
| 950 | } |
| 951 | }) |
| 952 | t.Run("parallel requests with config reloading", func(t *testing.T) { |
| 953 | f := func() { |
| 954 | proxy.applyConfig(newConfig()) |
| 955 | req := httptest.NewRequest("GET", fmt.Sprintf("%s/fast", fakeServer.URL), nil) |
| 956 | makeCustomRequest(proxy, req) |
| 957 | } |
| 958 | if err := testConcurrent(f, 100); err != nil { |
| 959 | t.Fatalf("concurrent test err: %s", err) |
| 960 | } |
| 961 | }) |
| 962 | } |
| 963 | |
| 964 | func TestReverseProxy_ServeHTTP2(t *testing.T) { |
| 965 | testCases := []struct { |
nothing calls this directly
no test coverage detected