Browse Source

Fix cluster bootstrap test

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/5032/head
Brad Davidson 3 years ago committed by Brad Davidson
parent
commit
54bb65064e
  1. 8
      pkg/cluster/bootstrap_test.go

8
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,

Loading…
Cancel
Save