Minor stuff: debug logs, unit test update
This commit is contained in:
@@ -18,9 +18,10 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
|
log "github.com/Sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type requestType int
|
type requestType int
|
||||||
@@ -64,6 +65,7 @@ func (fs *fileStore) fileStoreService() {
|
|||||||
req := <-fs.requestChannel
|
req := <-fs.requestChannel
|
||||||
response := &fileStoreResponse{}
|
response := &fileStoreResponse{}
|
||||||
|
|
||||||
|
log.WithFields(log.Fields{"file": req.fileName, "type": req.requestType}).Debug("fileStore request")
|
||||||
switch req.requestType {
|
switch req.requestType {
|
||||||
case READ:
|
case READ:
|
||||||
response.fileContents, response.error = ioutil.ReadFile(path.Join(fs.root, req.fileName))
|
response.fileContents, response.error = ioutil.ReadFile(path.Join(fs.root, req.fileName))
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func TestFileStore(t *testing.T) {
|
|||||||
t.Fatalf("expected an error")
|
t.Fatalf("expected an error")
|
||||||
}
|
}
|
||||||
|
|
||||||
path := "foo"
|
path := "fileStoreTest"
|
||||||
contents := []byte("bar")
|
contents := []byte("bar")
|
||||||
err = fs.write(path, contents)
|
err = fs.write(path, contents)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user