From 54bb65064e0fe7128e62731f6046f276afd2446a Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Thu, 24 Feb 2022 10:55:13 -0800 Subject: [PATCH] Fix cluster bootstrap test Signed-off-by: Brad Davidson --- pkg/cluster/bootstrap_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/cluster/bootstrap_test.go b/pkg/cluster/bootstrap_test.go index c9d623ed18..86d6e5f2c3 100644 --- a/pkg/cluster/bootstrap_test.go +++ b/pkg/cluster/bootstrap_test.go @@ -82,13 +82,13 @@ func Test_isDirEmpty(t *testing.T) { func TestCluster_certDirsExist(t *testing.T) { const testDataDir = "/tmp/k3s/" + testCredDir := filepath.Join(testDataDir, "server", "cred") testTLSDir := filepath.Join(testDataDir, "server", "tls") testTLSEtcdDir := filepath.Join(testDataDir, "server", "tls", "etcd") type fields struct { clientAccessInfo *clientaccess.Info config *config.Control - runtime *config.ControlRuntime managedDB managed.Driver etcdConfig endpoint.ETCDConfig shouldBootstrap bool @@ -110,8 +110,10 @@ func TestCluster_certDirsExist(t *testing.T) { }, }, setup: func() error { + os.MkdirAll(testCredDir, 0700) os.MkdirAll(testTLSEtcdDir, 0700) + _, _ = os.Create(filepath.Join(testCredDir, "test_file")) _, _ = os.Create(filepath.Join(testTLSDir, "test_file")) _, _ = os.Create(filepath.Join(testTLSEtcdDir, "test_file")) @@ -128,7 +130,6 @@ func TestCluster_certDirsExist(t *testing.T) { c := &Cluster{ clientAccessInfo: tt.fields.clientAccessInfo, config: tt.fields.config, - runtime: tt.fields.runtime, managedDB: tt.fields.managedDB, EtcdConfig: tt.fields.etcdConfig, storageStarted: tt.fields.storageStarted, @@ -150,7 +151,6 @@ func TestCluster_migrateBootstrapData(t *testing.T) { type fields struct { clientAccessInfo *clientaccess.Info config *config.Control - runtime *config.ControlRuntime managedDB managed.Driver etcdConfig endpoint.ETCDConfig joining bool @@ -206,7 +206,6 @@ func TestCluster_Snapshot(t *testing.T) { type fields struct { clientAccessInfo *clientaccess.Info config *config.Control - runtime *config.ControlRuntime managedDB managed.Driver etcdConfig endpoint.ETCDConfig joining bool @@ -238,7 +237,6 @@ func TestCluster_Snapshot(t *testing.T) { c := &Cluster{ clientAccessInfo: tt.fields.clientAccessInfo, config: tt.fields.config, - runtime: tt.fields.runtime, managedDB: tt.fields.managedDB, EtcdConfig: tt.fields.etcdConfig, joining: tt.fields.joining,