Minor stuff: debug logs, unit test update

This commit is contained in:
Soam Vasani
2016-09-20 00:44:19 -07:00
parent a0cfadbd73
commit be16c6a2aa
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -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))
+1 -1
View File
@@ -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 {