diff options
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5store_test.go')
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5store_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5store_test.go b/src/hub/src/spreadspace.org/sfive/s5store_test.go index ed49175..49ca35e 100644 --- a/src/hub/src/spreadspace.org/sfive/s5store_test.go +++ b/src/hub/src/spreadspace.org/sfive/s5store_test.go @@ -65,3 +65,27 @@ func TestCount(t *testing.T) { t.Errorf("Failed to count correctly.") } } + +func TestGetUpdatesAfter(t *testing.T) { + store, err := NewStore("file:memdb1?mode=memory&cache=shared") + if err != nil { + t.Errorf("Failed to initialize: %v", err) + return + } + defer store.Close() + + startTime := time.Date(2014, time.August, 24, 14, 35, 33, 847282000, time.UTC) + update := DataUpdate{Data: SourceData{BytesSent: 1, ClientCount: 3, BytesReceived: 1}, StartTime: startTime, Duration: 5 * time.Millisecond} + streamId := StreamId{ContentId: "content", Format: "7bitascii", Quality: QualityHigh} + source := SourceId{Hostname: "localhost", Tags: []string{"tag1", "master"}, StreamId: streamId, Version: 1} + dat := StatisticsData{nil, nil, source, update} + + err = store.Append(dat) + if err != nil { + t.Errorf("Failed to append: %v", err) + return + } + + res, err := store.GetUpdatesAfter(2) + t.Logf("got updates (err %v):\n%#v", err, res) +} |