mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Clean shutdown of client integration tests
This commit is contained in:
parent
e9e494e14a
commit
f673c262bd
@ -36,6 +36,11 @@ type tlsTransportCache struct {
|
|||||||
transports map[tlsCacheKey]*http.Transport
|
transports map[tlsCacheKey]*http.Transport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DialerStopCh is stop channel that is passed down to dynamic cert dialer.
|
||||||
|
// It's exposed as variable for testing purposes to avoid testing for goroutine
|
||||||
|
// leakages.
|
||||||
|
var DialerStopCh = wait.NeverStop
|
||||||
|
|
||||||
const idleConnsPerHost = 25
|
const idleConnsPerHost = 25
|
||||||
|
|
||||||
var tlsCache = &tlsTransportCache{transports: make(map[tlsCacheKey]*http.Transport)}
|
var tlsCache = &tlsTransportCache{transports: make(map[tlsCacheKey]*http.Transport)}
|
||||||
@ -101,7 +106,7 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) {
|
|||||||
dynamicCertDialer := certRotatingDialer(tlsConfig.GetClientCertificate, dial)
|
dynamicCertDialer := certRotatingDialer(tlsConfig.GetClientCertificate, dial)
|
||||||
tlsConfig.GetClientCertificate = dynamicCertDialer.GetClientCertificate
|
tlsConfig.GetClientCertificate = dynamicCertDialer.GetClientCertificate
|
||||||
dial = dynamicCertDialer.connDialer.DialContext
|
dial = dynamicCertDialer.connDialer.DialContext
|
||||||
go dynamicCertDialer.Run(wait.NeverStop)
|
go dynamicCertDialer.Run(DialerStopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy := http.ProxyFromEnvironment
|
proxy := http.ProxyFromEnvironment
|
||||||
|
@ -46,6 +46,7 @@ func TestCertRotation(t *testing.T) {
|
|||||||
defer close(stopCh)
|
defer close(stopCh)
|
||||||
|
|
||||||
transport.CertCallbackRefreshDuration = 1 * time.Second
|
transport.CertCallbackRefreshDuration = 1 * time.Second
|
||||||
|
transport.DialerStopCh = stopCh
|
||||||
|
|
||||||
certDir := os.TempDir()
|
certDir := os.TempDir()
|
||||||
clientCAFilename, clientSigningCert, clientSigningKey := writeCACertFiles(t, certDir)
|
clientCAFilename, clientSigningCert, clientSigningKey := writeCACertFiles(t, certDir)
|
||||||
@ -103,6 +104,7 @@ func TestCertRotationContinuousRequests(t *testing.T) {
|
|||||||
defer close(stopCh)
|
defer close(stopCh)
|
||||||
|
|
||||||
transport.CertCallbackRefreshDuration = 1 * time.Second
|
transport.CertCallbackRefreshDuration = 1 * time.Second
|
||||||
|
transport.DialerStopCh = stopCh
|
||||||
|
|
||||||
certDir := os.TempDir()
|
certDir := os.TempDir()
|
||||||
clientCAFilename, clientSigningCert, clientSigningKey := writeCACertFiles(t, certDir)
|
clientCAFilename, clientSigningCert, clientSigningKey := writeCACertFiles(t, certDir)
|
||||||
|
Loading…
Reference in New Issue
Block a user