diff --git a/api/fsapi/by_artist.go b/api/fsapi/by_artist.go index 7519d1e0c1fbc5b7ffacfa569eb41dc54ad554b7..85472666ed3bfec49156a2ad166f8cbcd216ef9e 100644 --- a/api/fsapi/by_artist.go +++ b/api/fsapi/by_artist.go @@ -48,8 +48,12 @@ func (afs *ByArtistFilesystem) Stat(path string) (Attr, error) { if len(p) == 3 { return afs.getSong(p[0], p[1], p[2]) } else if len(p) < 3 { + name := "/" + if len(p) > 0 { + name = p[len(p)-1] + } attr := Attr{ - Name: p[len(p)-1], + Name: name, IsDir: true, } return attr, nil diff --git a/test.sh b/test.sh index 82528d34f1fa75685e95bcd849b5dfbde5fa5d8a..336b2ebb28e1353fbf1784dabbeb163c2a6e8422 100644 --- a/test.sh +++ b/test.sh @@ -24,16 +24,16 @@ generate_server_conf() { cat >$1 <<EOF { "db_path": "${root}/djrandom.db", - "db_addr": "localhost:3007", + "db_addr": "127.0.0.1:3007", "storage_root": "${root}/fs", "storage_pmap": "${root}/part.json", - "storage_self": "http://localhost:3003", + "storage_self": "http://127.0.0.1:3003", "storage_key_id": "abcdef", "storage_key_secret": "123456", "index_pmap": "${root}/part-index.json", - "index_self": "localhost:3002", + "index_self": "127.0.0.1:3002", "index_file": "${root}/djindex", - "task_server_addr": "http://localhost:3005", + "task_server_addr": "http://127.0.0.1:3005", "last_fm_api_key": "1234" } EOF @@ -44,7 +44,7 @@ generate_client_conf() { { "music_dir": "${music_dir}", "db_path": "${root}/djclient.db", - "server": "http://localhost:3001", + "server": "http://127.0.0.1:3001", "auth_key": "${auth_key}", "auth_secret": "${auth_secret}" } @@ -52,17 +52,19 @@ EOF } generate_storage_part() { - ${bindir}/parttool --parts=16 --file=$1 create http://localhost:3003 + ${bindir}/parttool --parts=16 --file=$1 create http://127.0.0.1:3003 } generate_index_part() { - ${bindir}/parttool --parts=16 --file=$1 create localhost:3002 + ${bindir}/parttool --parts=16 --file=$1 create 127.0.0.1:3002 } start_daemons() { for d in $DAEMONS ; do local pidfile=${root}/${d}.pid - ${bindir}/${d} --config=${root}/djrandom.conf --pid-file=${pidfile} & + local logfile=${root}/${d}.log + ${bindir}/${d} --config=${root}/djrandom.conf --pid-file=${pidfile} \ + --log-file=${logfile} & done } @@ -100,6 +102,11 @@ run_mr_stats() { | ${bindir}/mr_stats --config=${root}/djrandom.conf --mapreduce } +run_mr_davfs() { + ${bindir}/mr_dump_bucket --config=${root}/djrandom.conf --bucket=song \ + | ${bindir}/mr_davfs --config=${root}/djrandom.conf --mapreduce +} + setup start_daemons sleep 1 @@ -111,6 +118,7 @@ echo ${root} sleep 1 run_client run_mr_stats +run_mr_davfs echo "*** TEST COMPLETE ***" echo