mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Clean shutdown of certificates integration tests
This commit is contained in:
parent
783da34f54
commit
d9d46d5326
@ -31,10 +31,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
certificatesinformers "k8s.io/client-go/informers/certificates/v1"
|
certificatesinformers "k8s.io/client-go/informers/certificates/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
|
||||||
certificateslisters "k8s.io/client-go/listers/certificates/v1"
|
certificateslisters "k8s.io/client-go/listers/certificates/v1"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/record"
|
|
||||||
"k8s.io/client-go/util/workqueue"
|
"k8s.io/client-go/util/workqueue"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kubernetes/pkg/controller"
|
"k8s.io/kubernetes/pkg/controller"
|
||||||
@ -60,11 +58,6 @@ func NewCertificateController(
|
|||||||
csrInformer certificatesinformers.CertificateSigningRequestInformer,
|
csrInformer certificatesinformers.CertificateSigningRequestInformer,
|
||||||
handler func(context.Context, *certificates.CertificateSigningRequest) error,
|
handler func(context.Context, *certificates.CertificateSigningRequest) error,
|
||||||
) *CertificateController {
|
) *CertificateController {
|
||||||
// Send events to the apiserver
|
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
|
||||||
eventBroadcaster.StartStructuredLogging(0)
|
|
||||||
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")})
|
|
||||||
|
|
||||||
cc := &CertificateController{
|
cc := &CertificateController{
|
||||||
name: name,
|
name: name,
|
||||||
kubeClient: kubeClient,
|
kubeClient: kubeClient,
|
||||||
|
@ -51,12 +51,12 @@ import (
|
|||||||
func TestCSRDuration(t *testing.T) {
|
func TestCSRDuration(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
|
||||||
t.Cleanup(cancel)
|
|
||||||
|
|
||||||
s := kubeapiservertesting.StartTestServerOrDie(t, nil, nil, framework.SharedEtcd())
|
s := kubeapiservertesting.StartTestServerOrDie(t, nil, nil, framework.SharedEtcd())
|
||||||
t.Cleanup(s.TearDownFn)
|
t.Cleanup(s.TearDownFn)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||||
|
t.Cleanup(cancel)
|
||||||
|
|
||||||
// assert that the metrics we collect during the test run match expectations
|
// assert that the metrics we collect during the test run match expectations
|
||||||
// we have 7 valid test cases below that request a duration of which 6 should have their duration honored
|
// we have 7 valid test cases below that request a duration of which 6 should have their duration honored
|
||||||
wantMetricStrings := []string{
|
wantMetricStrings := []string{
|
||||||
|
Loading…
Reference in New Issue
Block a user