summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2017-04-30 05:05:38 +0200
committerChristian Pointner <equinox@spreadspace.org>2017-04-30 05:05:38 +0200
commit1ff58dd9ccc9fca93160491d45f555a09f804df3 (patch)
tree0834203f6cae375cde15f0be021ed921d255824b /src
parentminor store file size optimization (diff)
added coverage test and some cleanup
Diffstat (limited to 'src')
-rw-r--r--src/hub/Makefile5
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5store.go16
2 files changed, 10 insertions, 11 deletions
diff --git a/src/hub/Makefile b/src/hub/Makefile
index dd77ded..daf06ef 100644
--- a/src/hub/Makefile
+++ b/src/hub/Makefile
@@ -80,6 +80,11 @@ bench: getlibs
@echo "testing and benchmarking: sfive"
@$(GOCMD) test -bench=. spreadspace.org/sfive
+cover: getlibs
+ @echo "testing and benchmarking: sfive"
+ @$(GOCMD) test -coverprofile=coverage.out spreadspace.org/sfive
+ @$(GOCMD) tool cover -html=coverage.out
+
clean:
rm -rf pkg/*/spreadspace.org
rm -rf bin
diff --git a/src/hub/src/spreadspace.org/sfive/s5store.go b/src/hub/src/spreadspace.org/sfive/s5store.go
index 568b448..c5cf3ef 100644
--- a/src/hub/src/spreadspace.org/sfive/s5store.go
+++ b/src/hub/src/spreadspace.org/sfive/s5store.go
@@ -400,21 +400,15 @@ func (st Store) getClients(tx *bolt.Tx, id int) (res []ClientData, err error) {
// fetch all the key-value pairs and merge them into the multidimensional dataupdate
func (st Store) fetchItem(tx *bolt.Tx, duId int, du dataUpdateDb) (res DataUpdateFull, err error) {
- var clients []ClientData
- if clients, err = st.getClients(tx, duId); err != nil {
- return
- }
+ res.CopyFromDataUpdateDb(du, st.getHub(tx, du.SourceHubId), st.hubUuid, duId)
var src sourceDb
if src, err = st.getSource(tx, du.SourceId); err != nil {
return
}
- res.CopyFromDataUpdateDb(du, st.getHub(tx, du.SourceHubId), st.hubUuid, duId)
- res.Hostname = src.Hostname
- res.StreamId.ContentId = src.StreamId.ContentId
- res.StreamId.Format = src.StreamId.Format
- res.StreamId.Quality = src.StreamId.Quality
- res.Tags = src.Tags
- res.Data.Clients = clients
+ res.CopyFromSourceDb(src)
+ if res.Data.Clients, err = st.getClients(tx, duId); err != nil {
+ return
+ }
return
}