summaryrefslogtreecommitdiff
path: root/src/hub/src/spreadspace.org/sfive/s5store_test.go
blob: 3ff437e14b163b63be43e0b40e980f3c6fad3bba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package sfive

import (
	"testing"
	"time"
)

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.")
	}
}