Commit 54bb6506 authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Fix cluster bootstrap test

parent 0a56b29d
...@@ -82,13 +82,13 @@ func Test_isDirEmpty(t *testing.T) { ...@@ -82,13 +82,13 @@ func Test_isDirEmpty(t *testing.T) {
func TestCluster_certDirsExist(t *testing.T) { func TestCluster_certDirsExist(t *testing.T) {
const testDataDir = "/tmp/k3s/" const testDataDir = "/tmp/k3s/"
testCredDir := filepath.Join(testDataDir, "server", "cred")
testTLSDir := filepath.Join(testDataDir, "server", "tls") testTLSDir := filepath.Join(testDataDir, "server", "tls")
testTLSEtcdDir := filepath.Join(testDataDir, "server", "tls", "etcd") testTLSEtcdDir := filepath.Join(testDataDir, "server", "tls", "etcd")
type fields struct { type fields struct {
clientAccessInfo *clientaccess.Info clientAccessInfo *clientaccess.Info
config *config.Control config *config.Control
runtime *config.ControlRuntime
managedDB managed.Driver managedDB managed.Driver
etcdConfig endpoint.ETCDConfig etcdConfig endpoint.ETCDConfig
shouldBootstrap bool shouldBootstrap bool
...@@ -110,8 +110,10 @@ func TestCluster_certDirsExist(t *testing.T) { ...@@ -110,8 +110,10 @@ func TestCluster_certDirsExist(t *testing.T) {
}, },
}, },
setup: func() error { setup: func() error {
os.MkdirAll(testCredDir, 0700)
os.MkdirAll(testTLSEtcdDir, 0700) os.MkdirAll(testTLSEtcdDir, 0700)
_, _ = os.Create(filepath.Join(testCredDir, "test_file"))
_, _ = os.Create(filepath.Join(testTLSDir, "test_file")) _, _ = os.Create(filepath.Join(testTLSDir, "test_file"))
_, _ = os.Create(filepath.Join(testTLSEtcdDir, "test_file")) _, _ = os.Create(filepath.Join(testTLSEtcdDir, "test_file"))
...@@ -128,7 +130,6 @@ func TestCluster_certDirsExist(t *testing.T) { ...@@ -128,7 +130,6 @@ func TestCluster_certDirsExist(t *testing.T) {
c := &Cluster{ c := &Cluster{
clientAccessInfo: tt.fields.clientAccessInfo, clientAccessInfo: tt.fields.clientAccessInfo,
config: tt.fields.config, config: tt.fields.config,
runtime: tt.fields.runtime,
managedDB: tt.fields.managedDB, managedDB: tt.fields.managedDB,
EtcdConfig: tt.fields.etcdConfig, EtcdConfig: tt.fields.etcdConfig,
storageStarted: tt.fields.storageStarted, storageStarted: tt.fields.storageStarted,
...@@ -150,7 +151,6 @@ func TestCluster_migrateBootstrapData(t *testing.T) { ...@@ -150,7 +151,6 @@ func TestCluster_migrateBootstrapData(t *testing.T) {
type fields struct { type fields struct {
clientAccessInfo *clientaccess.Info clientAccessInfo *clientaccess.Info
config *config.Control config *config.Control
runtime *config.ControlRuntime
managedDB managed.Driver managedDB managed.Driver
etcdConfig endpoint.ETCDConfig etcdConfig endpoint.ETCDConfig
joining bool joining bool
...@@ -206,7 +206,6 @@ func TestCluster_Snapshot(t *testing.T) { ...@@ -206,7 +206,6 @@ func TestCluster_Snapshot(t *testing.T) {
type fields struct { type fields struct {
clientAccessInfo *clientaccess.Info clientAccessInfo *clientaccess.Info
config *config.Control config *config.Control
runtime *config.ControlRuntime
managedDB managed.Driver managedDB managed.Driver
etcdConfig endpoint.ETCDConfig etcdConfig endpoint.ETCDConfig
joining bool joining bool
...@@ -238,7 +237,6 @@ func TestCluster_Snapshot(t *testing.T) { ...@@ -238,7 +237,6 @@ func TestCluster_Snapshot(t *testing.T) {
c := &Cluster{ c := &Cluster{
clientAccessInfo: tt.fields.clientAccessInfo, clientAccessInfo: tt.fields.clientAccessInfo,
config: tt.fields.config, config: tt.fields.config,
runtime: tt.fields.runtime,
managedDB: tt.fields.managedDB, managedDB: tt.fields.managedDB,
EtcdConfig: tt.fields.etcdConfig, EtcdConfig: tt.fields.etcdConfig,
joining: tt.fields.joining, joining: tt.fields.joining,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment