MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / TestProxyError

Function TestProxyError

proxy/proxy_test.go:414–441  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

412}
413
414func TestProxyError(t *testing.T) {
415 ing := ingress.Ingress{
416 Rules: []ingress.Rule{
417 {
418 Hostname: "*",
419 Path: nil,
420 Service: ingress.MockOriginHTTPService{
421 Transport: errorOriginTransport{},
422 },
423 },
424 },
425 }
426
427 log := zerolog.Nop()
428
429 originDialer := ingress.NewOriginDialer(ingress.OriginConfig{
430 DefaultDialer: testDefaultDialer,
431 TCPWriteTimeout: 1 * time.Second,
432 }, &log)
433
434 proxy := NewOriginProxy(ing, originDialer, testTags, cfdflow.NewLimiter(0), &log)
435
436 responseWriter := newMockHTTPRespWriter()
437 req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1", nil)
438 require.NoError(t, err)
439
440 require.Error(t, proxy.ProxyHTTP(responseWriter, tracing.NewTracedHTTPRequest(req, 0, &log), false))
441}
442
443type replayer struct {
444 sync.RWMutex

Callers

nothing calls this directly

Calls 6

ProxyHTTPMethod · 0.95
NewOriginDialerFunction · 0.92
NewTracedHTTPRequestFunction · 0.92
NewOriginProxyFunction · 0.85
newMockHTTPRespWriterFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected