Fix client init logging and test
This commit is contained in:
parent
70a1a37f84
commit
6ca7c6680d
|
@ -156,15 +156,15 @@ func (c *Client) init() error {
|
|||
if err := os.MkdirAll(c.config.AllocDir, 0700); err != nil {
|
||||
return fmt.Errorf("failed creating alloc dir: %s", err)
|
||||
}
|
||||
} else {
|
||||
// Othewise make a temp directory to use.
|
||||
p, err := ioutil.TempDir("", "NomadClient")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed creating temporary directory for the AllocDir: %v", err)
|
||||
}
|
||||
c.config.AllocDir = p
|
||||
}
|
||||
|
||||
// Othewise make a temp directory to use.
|
||||
p, err := ioutil.TempDir("", "NomadClient")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed creating temporary directory for the AllocDir: %v", err)
|
||||
}
|
||||
c.config.AllocDir = p
|
||||
|
||||
c.logger.Printf("[INFO] client: using alloc directory %v", c.config.AllocDir)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package client
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -393,6 +394,7 @@ func TestClient_Init(t *testing.T) {
|
|||
config: &config.Config{
|
||||
AllocDir: allocDir,
|
||||
},
|
||||
logger: log.New(os.Stderr, "", log.LstdFlags),
|
||||
}
|
||||
if err := client.init(); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
|
Loading…
Reference in New Issue