-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathevents_parity_test.go
More file actions
46 lines (40 loc) · 1.27 KB
/
events_parity_test.go
File metadata and controls
46 lines (40 loc) · 1.27 KB
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
package featurevisor
import "testing"
func TestGetParamsForDatafileSetEventShape(t *testing.T) {
logger := NewLogger(CreateLoggerOptions{})
previousReader := NewDatafileReader(DatafileReaderOptions{
Logger: logger,
Datafile: DatafileContent{
SchemaVersion: "2",
Revision: "1",
Segments: map[SegmentKey]Segment{},
Features: map[FeatureKey]Feature{
"a": {Hash: parityStringPtr("h1"), BucketBy: "userId", Traffic: []Traffic{}},
},
},
})
newReader := NewDatafileReader(DatafileReaderOptions{
Logger: logger,
Datafile: DatafileContent{
SchemaVersion: "2",
Revision: "2",
Segments: map[SegmentKey]Segment{},
Features: map[FeatureKey]Feature{
"a": {Hash: parityStringPtr("h2"), BucketBy: "userId", Traffic: []Traffic{}},
},
},
})
params := getParamsForDatafileSetEvent(previousReader, newReader)
if _, exists := params["removedFeatures"]; exists {
t.Fatalf("did not expect removedFeatures field in event details")
}
if _, exists := params["changedFeatures"]; exists {
t.Fatalf("did not expect changedFeatures field in event details")
}
if _, exists := params["addedFeatures"]; exists {
t.Fatalf("did not expect addedFeatures field in event details")
}
}
func parityStringPtr(value string) *string {
return &value
}