mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 00:15:43 +03:00
Fix client init logging and test
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user