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 | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5store_test.go b/src/hub/src/spreadspace.org/sfive/s5store_test.go index 7708525..3ff437e 100644 --- a/src/hub/src/spreadspace.org/sfive/s5store_test.go +++ b/src/hub/src/spreadspace.org/sfive/s5store_test.go @@ -5,9 +5,33 @@ import ( "time" ) -func TestStuff(t *testing.T) { - gd := initDb() - dat := dataUpdateDb{-1, DataUpdate{Data: SourceData{BytesSent: 1, ClientCount: 3, BytesReceived: 1}, StartTime: time.Date(2014, time.August, 24, 14, 35, 33, 847282000, time.UTC), Duration: 5000}} - gd.Insert(dat) - // _ = gd.Db +func TestAppend(t *testing.T) { + store, err := NewStore() + if err != nil { + t.Errorf("Failed to initialize: %v", err) + } + defer EatDataAndClose(store) + + 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} + dat := StatisticsData{source, update} + + err = store.Append(dat) + if err != nil { + t.Errorf("Failed to append: %v", err) + } +} + +func IgnoreTestCount(t *testing.T) { + store, err := NewStore() + if err != nil { + t.Errorf("Failed to initialize: %v", err) + } + defer EatDataAndClose(store) + + if 0 != store.ClientCount(nil) { + t.Errorf("Failed to count correctly.") + } } |