1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-03 22:52:30 +02:00

Rely on net/http error content rather than unreliable deadline exceeded (#5631)

This test is flaky in CI because we rely on the `context.Context`
timeout to be returned, but depending where in the request the timeout
happens, there could be an `io timeout` instead.

By relying on the `net/http` `Client.Timeout` error instead, the test
shouldn't be flaky anymore, as we're able to check for timeout, no
matter where in the request it happened.

70491a8111/src/net/http/client.go (L729)

Closes #5630.
cc @pree-dew
This commit is contained in:
Damien Mathieu 2024-07-19 10:25:49 +02:00 committed by GitHub
parent 52d4ce66e5
commit d2d94d6ae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -238,7 +238,7 @@ func TestTimeout(t *testing.T) {
assert.NoError(t, exporter.Shutdown(ctx))
}()
err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan())
assert.ErrorContains(t, err, "context deadline exceeded")
assert.ErrorContains(t, err, "Client.Timeout exceeded while awaiting headers")
}
func TestNoRetry(t *testing.T) {