mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
kubeadm unit test initalize global variables
This commit is contained in:
parent
fcee7a0105
commit
dbc6226e7f
@ -41,6 +41,12 @@ func (t *testCertsData) CertificateDir() string { return t.cfg.Certi
|
|||||||
func (t *testCertsData) CertificateWriteDir() string { return t.cfg.CertificatesDir }
|
func (t *testCertsData) CertificateWriteDir() string { return t.cfg.CertificatesDir }
|
||||||
|
|
||||||
func TestCertsWithCSRs(t *testing.T) {
|
func TestCertsWithCSRs(t *testing.T) {
|
||||||
|
// restore global variables
|
||||||
|
defer func() {
|
||||||
|
csrOnly = false
|
||||||
|
csrDir = ""
|
||||||
|
}()
|
||||||
|
|
||||||
csrDir := testutil.SetupTempDir(t)
|
csrDir := testutil.SetupTempDir(t)
|
||||||
defer os.RemoveAll(csrDir)
|
defer os.RemoveAll(csrDir)
|
||||||
certDir := testutil.SetupTempDir(t)
|
certDir := testutil.SetupTempDir(t)
|
||||||
@ -52,12 +58,9 @@ func TestCertsWithCSRs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
certsData.cfg.CertificatesDir = certDir
|
certsData.cfg.CertificatesDir = certDir
|
||||||
|
|
||||||
// global vars
|
// set global vars for the test
|
||||||
csrOnly = true
|
csrOnly = true
|
||||||
csrDir = certDir
|
csrDir = certDir
|
||||||
defer func() {
|
|
||||||
csrOnly = false
|
|
||||||
}()
|
|
||||||
|
|
||||||
phase := NewCertsPhase()
|
phase := NewCertsPhase()
|
||||||
// find the api cert phase
|
// find the api cert phase
|
||||||
|
Loading…
Reference in New Issue
Block a user