-
Notifications
You must be signed in to change notification settings - Fork 2
/
observation_test.go
65 lines (46 loc) · 1.51 KB
/
observation_test.go
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package pto3_test
import (
"testing"
pto3 "github.com/mami-project/pto3-go"
)
func TestObsetQuery(t *testing.T) {
setIds, err := pto3.ObservationSetIDsWithMetadata(TestDB, "this_is_the_query_test_obset")
if err != nil {
t.Fatal(err)
}
if len(setIds) != 1 || setIds[0] != TestQueryCacheSetID {
t.Fatalf("unexpected result for this_is_the_query_test_obset: %v", setIds)
}
setIds, err = pto3.ObservationSetIDsWithMetadataValue(TestDB, "test_obset_type", "query")
if err != nil {
t.Fatal(err)
}
if len(setIds) != 1 || setIds[0] != TestQueryCacheSetID {
t.Fatalf("unexpected result for test_obset_type == query: %v", setIds)
}
setIds, err = pto3.ObservationSetIDsWithSource(TestDB, "https://localhost:8383/raw/test1/test1-0-obs.ndjson")
if err != nil {
t.Fatal(err)
}
if len(setIds) != 1 || setIds[0] != TestQueryCacheSetID {
t.Fatalf("unexpected result for set ID query by source: %v", setIds)
}
setIds, err = pto3.ObservationSetIDsWithAnalyzer(TestDB, "https://localhost:8383/query_test_analyzer.json")
if err != nil {
t.Fatal(err)
}
if len(setIds) != 1 || setIds[0] != TestQueryCacheSetID {
t.Fatalf("unexpected result for set ID query by analyzer: %v", setIds)
}
cidCache, err := pto3.LoadConditionCache(TestDB)
if err != nil {
t.Fatalf("condition cache load failed")
}
setIds, err = pto3.ObservationSetIDsWithCondition(TestDB, cidCache, "pto.test.color.none_more_black")
if err != nil {
t.Fatal(err)
}
if len(setIds) < 1 {
t.Fatalf("no sets found with none_more_black")
}
}