Merge pull request #10806 from prezha/fix-testlogfile
make sure path to logs directory existspull/10893/head
commit
ebb13e56ea
|
@ -20,12 +20,19 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/minikube/pkg/minikube/localpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLogFile(t *testing.T) {
|
func TestLogFile(t *testing.T) {
|
||||||
t.Run("SetLogFile", func(t *testing.T) {
|
t.Run("SetLogFile", func(t *testing.T) {
|
||||||
|
// make sure logs directory exists
|
||||||
|
if err := os.MkdirAll(filepath.Dir(localpath.AuditLog()), 0755); err != nil {
|
||||||
|
t.Fatalf("Error creating logs directory: %v", err)
|
||||||
|
}
|
||||||
if err := setLogFile(); err != nil {
|
if err := setLogFile(); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue