Unbound Release / Check Preconditions (push) Successful in 27s
Unbound Release / Create Tag (push) Skipped
otelsetup / test (push) Skipped
otelsetup / vulnerabilities (push) Skipped
Unbound Release / Generate Changelog and Handle PR (push) Successful in 39s
Unbound Release / Create Release (push) Successful in 29s
Release / release (push) Successful in 1m14s
pre-commit / pre-commit (push) Successful in 3m27s
23 lines
625 B
Go
23 lines
625 B
Go
package otelsetup
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestOTLPHTTPClient_ClosesIdleConnectionsBeforeTheCollector(t *testing.T) {
|
|
c := otlpHTTPClient()
|
|
tr, ok := c.Transport.(*http.Transport)
|
|
if !ok {
|
|
t.Fatalf("transport is %T, want *http.Transport", c.Transport)
|
|
}
|
|
// Alloy's OTLP receiver closes connections idle for 1m; the client must close first.
|
|
if tr.IdleConnTimeout <= 0 || tr.IdleConnTimeout >= time.Minute {
|
|
t.Errorf("IdleConnTimeout = %v, want in (0, 1m)", tr.IdleConnTimeout)
|
|
}
|
|
if c.Timeout != 10*time.Second {
|
|
t.Errorf("Timeout = %v, want 10s (the exporters' default)", c.Timeout)
|
|
}
|
|
}
|