You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: certmanager_test.go
    path of file: ./repos/openyurt/pkg/yurthub/yurtcoordinator/certmanager
    
    the code of the file until where you have to start completion: /*
Copyright 2023 The OpenYurt Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package certmanager

import (
	"fmt"
	"path/filepath"
	"reflect"
	"testing"
	"time"

	corev1 "k8s.io/api/core/v1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/client-go/informers"
	"k8s.io/client-go/kubernetes/fake"

	"github.com/openyurtio/openyurt/pkg/yurthub/util"
	"github.com/openyurtio/openyurt/pkg/yurthub/util/fs"
	"github.com/openyurtio/openyurt/pkg/yurthub/yurtcoordinator/constants"
)

const (
	testPKIDir = "/tmp/yurt-coordinator-pki"
	caByte     = `-----BEGIN CERTIFICATE-----
MIIC/jCCAeagAwIBAgIBADANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQDEwprdWJl
cm5ldGVzMB4XDTIyMTIyODAzMzgyM1oXDTMyMTIyNTAzMzgyM1owFTETMBEGA1UE
AxMKa3ViZXJuZXRlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKUI
4IgEu/xH2orH1uLx1ad+eBy8WcqwOaJKZMZqEgEorWRXUvsM/UAE447V/eGkvwT/
rFlFuyhVzpsecE4n2zK13lf7/cHD6raS4XR2vvbgX/KRkNPHPK38326zCu+rvZVU
9zq5rxXGHKytL+2uVuCnjP8xOtgEy9iB8kML2wWBMuO8Seyh4/F/jJ5Zrhi/zgHp
swfgvmEYz0BGFBqnVYYx7CST2ek95LVXnc3xS8wlmo+X4foiJG9mVSTGtfQoBQ2H
hg3vZV3+fsXNNYT4xigZ5kU97npaZk/nfZGyaHuEeiNWQOimQYCv
    
func TestSecretDelete(t *testing.T) {
	t.Run("Cert manager should clean cert when secret has been deleted", func(t *testing.T) {
		fakeClient, certMgr, cancel, err := initFakeClientAndCertManager()
		if err != nil {
			t.Errorf("failed to initialize, %v", err)
		}
		defer cancel()

		if err := fakeClient.Tracker().Add(yurtCoordinatorSecret); err != nil {
			t.Errorf("failed to add secret %s, %v", yurtCoordinatorSecret.Name, err)
		}

		err = wait.PollImmediate(50*time.Millisecond, 10*time.Second, func() (done bool, err error) {
			if pass, err := checkSecret(certMgr, yurtCoordinatorSecret, []expectFile{
				{
					FilePath: certMgr.GetFilePath(RootCA),
					Data:     yurtCoordinatorSecret.Data["ca.crt"],
					Exists:   true,
				},
				{
					FilePath: certMgr.GetFilePath(YurthubClientCert),
					Data:     yurtCoordinatorSecret.Data["yurt-coordinator-yurthub-client.crt"],
					Exists:   true,
				},
				{

					FilePath: certMgr.GetFilePath(YurthubClientKey),
					Data:     yurtCoordinatorSecret.Data["yurt-coordinator-yurthub-client.key"],
					Exists:   true,
				},
				{
					FilePath: certMgr.GetFilePath(NodeLeaseProxyClientCert),
					Exists:   false,
				},
				{
					FilePath: certMgr.GetFilePath(NodeLeaseProxyClientKey),
					Exists:   false,
				},
			}); !pass || err != nil {
				return pass, err
			}

			if certMgr.GetAPIServerClientCert() == nil {
				return false, nil
			}
			return true, nil
		})
		if err != nil {
			t.Errorf("failed to wait cert manager to be initialized, %v", err)
		}

		if err := fakeClient.Tracker().Delete(secretGVR, yurtCoordinatorSecret.Namespace, yurtCoordinatorSecret.Name); err != nil {
			t.Errorf("failed to delete secret, %v", err)
		}

		err = wait.PollImmediate(50*time.Millisecond, 10*time.Second, func() (done bool, err error) {
			if certMgr.GetAPIServerClientCert() != nil {
				return false, nil
			}
			if certMgr.GetNodeLeaseProxyClientCert() != nil {
				return false, nil
			}
			return true, nil
		})
		if err != nil {
			t.Errorf("failed to clean cert, %v", err)
		}

		if err := fileStore.DeleteDir(testPKIDir); err != nil {
			t.Errorf("failed to clean test dir %s, %v", testPKIDir, err)
		}
	})
}