Skip to content

Commit bcdd2d0

Browse files
committed
Updated commons version and added test cases
1 parent 428af14 commit bcdd2d0

File tree

10 files changed

+290
-37
lines changed

10 files changed

+290
-37
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ module github.com/splitio/go-client/v6
33
go 1.18
44

55
require (
6-
github.com/splitio/go-split-commons/v6 v6.1.0
6+
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250828154055-c4035408fe61
77
github.com/splitio/go-toolkit/v5 v5.4.0
8+
89
)
910

1011
require (
@@ -13,6 +14,7 @@ require (
1314
github.com/cespare/xxhash/v2 v2.2.0 // indirect
1415
github.com/davecgh/go-spew v1.1.1 // indirect
1516
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
17+
github.com/kr/text v0.2.0 // indirect
1618
github.com/pmezard/go-difflib v1.0.0 // indirect
1719
github.com/redis/go-redis/v9 v9.0.4 // indirect
1820
github.com/stretchr/objx v0.5.2 // indirect

go.sum

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
66
github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
77
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
88
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
9+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
910
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1011
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1112
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
1213
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
14+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
15+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
16+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1317
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1418
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1519
github.com/redis/go-redis/v9 v9.0.4 h1:FC82T+CHJ/Q/PdyLW++GeCO+Ol59Y4T7R4jbgjvktgc=
1620
github.com/redis/go-redis/v9 v9.0.4/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
17-
github.com/splitio/go-split-commons/v6 v6.1.0 h1:k3mwr12DF6gbEaV8XXU/tSAQlPkIEuzIgTEneYhGg2I=
18-
github.com/splitio/go-split-commons/v6 v6.1.0/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY=
21+
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250828154055-c4035408fe61 h1:xFXSVWXsaWRIfHCNtsvqDrLULBWnF8SOpkv045CXibI=
22+
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250828154055-c4035408fe61/go.mod h1:cuW2HjbJJCVjlmmgJyoTs5UFxz8ET8vCgMUvZg1/EBg=
1923
github.com/splitio/go-toolkit/v5 v5.4.0 h1:g5WFpRhQomnXCmvfsNOWV4s5AuUrWIZ+amM68G8NBKM=
2024
github.com/splitio/go-toolkit/v5 v5.4.0/go.mod h1:xYhUvV1gga9/1029Wbp5pjnR6Cy8nvBpjw99wAbsMko=
2125
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
@@ -28,7 +32,7 @@ golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM
2832
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
2933
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
3034
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
31-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3235
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
36+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
3337
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
3438
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

splitio/client/client_test.go

Lines changed: 113 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,9 +1011,11 @@ func TestBlockUntilReadyInMemoryOk(t *testing.T) {
10111011
}
10121012

10131013
splitChanges := dtos.SplitChangesDTO{
1014-
Splits: []dtos.SplitDTO{mockedSplit1, mockedSplit2, mockedSplit3},
1015-
Since: 3,
1016-
Till: 3,
1014+
FeatureFlags: dtos.FeatureFlagsDTO{
1015+
Splits: []dtos.SplitDTO{mockedSplit1, mockedSplit2, mockedSplit3},
1016+
Since: 3,
1017+
Till: 3,
1018+
},
10171019
}
10181020

10191021
raw, err := json.Marshal(splitChanges)
@@ -1362,6 +1364,7 @@ func TestClient(t *testing.T) {
13621364
},
13631365
},
13641366
nil,
1367+
nil,
13651368
logger,
13661369
)
13671370

@@ -2222,7 +2225,7 @@ func TestUnsupportedMatcherAndSemver(t *testing.T) {
22222225
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
22232226
switch r.URL.Path {
22242227
case "/api/v2/auth":
2225-
if r.URL.Query().Get("s") != "1.1" {
2228+
if r.URL.Query().Get("s") != "1.3" {
22262229
t.Error("should be parameter s, for flags spec")
22272230
}
22282231
fmt.Fprintln(w, "{\"pushEnabled\": false, \"token\": \"token\"}")
@@ -2329,6 +2332,103 @@ func TestUnsupportedMatcherAndSemver(t *testing.T) {
23292332
}
23302333
}
23312334

2335+
func TestRuleBasedSegmentMatcher(t *testing.T) {
2336+
var isDestroyCalled = false
2337+
var splitsMock, _ = ioutil.ReadFile("../../testdata/splits_mock_4.json")
2338+
2339+
postChannel := make(chan string, 1)
2340+
2341+
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2342+
switch r.URL.Path {
2343+
case "/api/v2/auth":
2344+
if r.URL.Query().Get("s") != "1.3" {
2345+
t.Error("should be parameter s, for flags spec")
2346+
}
2347+
fmt.Fprintln(w, "{\"pushEnabled\": false, \"token\": \"token\"}")
2348+
return
2349+
case "/splitChanges":
2350+
fmt.Fprintln(w, string(splitsMock))
2351+
return
2352+
case "/testImpressions/bulk":
2353+
if r.Header.Get("SplitSDKImpressionsMode") != commonsCfg.ImpressionsModeOptimized {
2354+
t.Error("Wrong header")
2355+
}
2356+
2357+
if isDestroyCalled {
2358+
rBody, _ := ioutil.ReadAll(r.Body)
2359+
var dataInPost []map[string]interface{}
2360+
err := json.Unmarshal(rBody, &dataInPost)
2361+
if err != nil {
2362+
t.Error(err)
2363+
return
2364+
}
2365+
if len(dataInPost) != 1 {
2366+
t.Error("It should send one impressions in optimized mode")
2367+
}
2368+
for _, ki := range dataInPost {
2369+
if asISlice, ok := ki["i"].([]interface{}); !ok || len(asISlice) != 1 {
2370+
t.Error("It should send only one impression per featureName", dataInPost)
2371+
}
2372+
if ki["f"] == "unsupported" {
2373+
message := ki["i"].([]interface{})[0].(map[string]interface{})["r"]
2374+
if message != "targeting rule type unsupported by sdk" {
2375+
t.Error("message sould be: targeting rule type unsupported by sdk")
2376+
}
2377+
}
2378+
}
2379+
}
2380+
2381+
fmt.Fprintln(w, "ok")
2382+
postChannel <- "finished"
2383+
case "/testImpressions/count":
2384+
fallthrough
2385+
case "/keys/ss":
2386+
fallthrough
2387+
case "/events/bulk":
2388+
fallthrough
2389+
case "/segmentChanges":
2390+
default:
2391+
fmt.Fprintln(w, "ok")
2392+
return
2393+
}
2394+
}))
2395+
defer ts.Close()
2396+
2397+
cfg := conf.Default()
2398+
cfg.Advanced.AuthServiceURL = ts.URL
2399+
cfg.Advanced.EventsURL = ts.URL
2400+
cfg.Advanced.SdkURL = ts.URL
2401+
cfg.Advanced.TelemetryServiceURL = ts.URL
2402+
2403+
factory, _ := NewSplitFactory("test", cfg)
2404+
client := factory.Client()
2405+
client.BlockUntilReady(100)
2406+
2407+
// Calls treatments to generate one valid impression
2408+
time.Sleep(300 * time.Millisecond) // Let's wait until first call of recorders have finished
2409+
attributes := make(map[string]interface{})
2410+
attributes["email"] = "test@split.io"
2411+
evaluation := client.Treatment("user1", "rbs_split", attributes)
2412+
if evaluation != "on" {
2413+
t.Error("evaluation for semver should be on")
2414+
}
2415+
evaluation = client.Treatment("user1", "unsupported", nil)
2416+
if evaluation != "control" {
2417+
t.Error("evaluation for unsupported should be control")
2418+
}
2419+
2420+
isDestroyCalled = true
2421+
client.Destroy()
2422+
2423+
select {
2424+
case <-postChannel:
2425+
return
2426+
case <-time.After(4 * time.Second):
2427+
t.Error("The test couldn't send impressions to check headers")
2428+
return
2429+
}
2430+
}
2431+
23322432
func TestTelemetryMemory(t *testing.T) {
23332433
factoryInstances = make(map[string]int64)
23342434
var metricsInitCalled int64
@@ -2337,14 +2437,15 @@ func TestTelemetryMemory(t *testing.T) {
23372437
sdkServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
23382438
time.Sleep(100 * time.Millisecond)
23392439
splitChanges := dtos.SplitChangesDTO{
2340-
Splits: []dtos.SplitDTO{
2341-
{Name: "split1", Killed: true, Status: "ACTIVE", DefaultTreatment: "on"},
2342-
{Name: "split2", Killed: true, Status: "ACTIVE"},
2343-
{Name: "split3", Killed: true, Status: "INACTIVE"},
2344-
},
2345-
Since: 3,
2346-
Till: 3,
2347-
}
2440+
FeatureFlags: dtos.FeatureFlagsDTO{
2441+
Splits: []dtos.SplitDTO{
2442+
{Name: "split1", Killed: true, Status: "ACTIVE", DefaultTreatment: "on"},
2443+
{Name: "split2", Killed: true, Status: "ACTIVE"},
2444+
{Name: "split3", Killed: true, Status: "INACTIVE"},
2445+
},
2446+
Since: 3,
2447+
Till: 3,
2448+
}}
23482449

23492450
raw, err := json.Marshal(splitChanges)
23502451
if err != nil {

splitio/client/factory.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const (
5252
type sdkStorages struct {
5353
splits storage.SplitStorageConsumer
5454
segments storage.SegmentStorageConsumer
55+
ruleBasedSegments storage.RuleBasedSegmentStorageConsumer
5556
impressionsConsumer storage.ImpressionStorageConsumer
5657
impressions storage.ImpressionStorageProducer
5758
events storage.EventStorageProducer
@@ -83,7 +84,7 @@ type SplitFactory struct {
8384
func (f *SplitFactory) Client() *SplitClient {
8485
return &SplitClient{
8586
logger: f.logger,
86-
evaluator: evaluator.NewEvaluator(f.storages.splits, f.storages.segments, engine.NewEngine(f.logger), f.logger),
87+
evaluator: evaluator.NewEvaluator(f.storages.splits, f.storages.segments, f.storages.ruleBasedSegments, engine.NewEngine(f.logger), f.logger),
8788
impressions: f.storages.impressions,
8889
events: f.storages.events,
8990
validator: inputValidation{
@@ -275,8 +276,8 @@ func setupInMemoryFactory(
275276
metadata dtos.Metadata,
276277
) (*SplitFactory, error) {
277278
advanced, warnings := conf.NormalizeSDKConf(cfg.Advanced)
278-
advanced.AuthSpecVersion = specs.FLAG_V1_1
279-
advanced.FlagsSpecVersion = specs.FLAG_V1_1
279+
advanced.AuthSpecVersion = specs.FLAG_V1_3
280+
advanced.FlagsSpecVersion = specs.FLAG_V1_3
280281
printWarnings(logger, warnings)
281282
flagSetsInvalid := int64(len(cfg.Advanced.FlagSetsFilter) - len(advanced.FlagSetsFilter))
282283
if strings.TrimSpace(cfg.SplitSyncProxyURL) != "" {
@@ -288,6 +289,7 @@ func setupInMemoryFactory(
288289
flagSetFilter := flagsets.NewFlagSetFilter(advanced.FlagSetsFilter)
289290
splitsStorage := mutexmap.NewMMSplitStorage(flagSetFilter)
290291
segmentsStorage := mutexmap.NewMMSegmentStorage()
292+
ruleBasedSegmentStorage := mutexmap.NewRuleBasedSegmentsStorage()
291293
telemetryStorage, err := inmemory.NewTelemetryStorage()
292294
impressionsStorage := mutexqueue.NewMQImpressionsStorage(cfg.Advanced.ImpressionsQueueSize, inMememoryFullQueue, logger, telemetryStorage)
293295
eventsStorage := mutexqueue.NewMQEventsStorage(cfg.Advanced.EventsQueueSize, inMememoryFullQueue, logger, telemetryStorage)
@@ -299,7 +301,7 @@ func setupInMemoryFactory(
299301

300302
splitAPI := api.NewSplitAPI(apikey, advanced, logger, metadata)
301303
workers := synchronizer.Workers{
302-
SplitUpdater: split.NewSplitUpdater(splitsStorage, splitAPI.SplitFetcher, logger, telemetryStorage, dummyHC, flagSetFilter),
304+
SplitUpdater: split.NewSplitUpdater(splitsStorage, ruleBasedSegmentStorage, splitAPI.SplitFetcher, logger, telemetryStorage, dummyHC, flagSetFilter),
303305
SegmentUpdater: segment.NewSegmentUpdater(splitsStorage, segmentsStorage, splitAPI.SegmentFetcher, logger, telemetryStorage, dummyHC),
304306
EventRecorder: event.NewEventRecorderSingle(eventsStorage, splitAPI.EventRecorder, logger, metadata, telemetryStorage),
305307
TelemetryRecorder: telemetry.NewTelemetrySynchronizer(telemetryStorage, splitAPI.TelemetryRecorder, splitsStorage, segmentsStorage, logger, metadata, telemetryStorage),
@@ -317,6 +319,7 @@ func setupInMemoryFactory(
317319
impressionsConsumer: impressionsStorage,
318320
impressions: impressionsStorage,
319321
segments: segmentsStorage,
322+
ruleBasedSegments: ruleBasedSegmentStorage,
320323
initTelemetry: telemetryStorage,
321324
evaluationTelemetry: telemetryStorage,
322325
runtimeTelemetry: telemetryStorage,
@@ -468,6 +471,7 @@ func setupLocalhostFactory(
468471
flagSetFilter := flagsets.NewFlagSetFilter(flagSets)
469472
splitStorage := mutexmap.NewMMSplitStorage(flagSetFilter)
470473
segmentStorage := mutexmap.NewMMSegmentStorage()
474+
ruleBasedSegmentStorage := mutexmap.NewRuleBasedSegmentsStorage()
471475
telemetryStorage, err := inmemory.NewTelemetryStorage()
472476
if err != nil {
473477
return nil, err
@@ -492,7 +496,7 @@ func setupLocalhostFactory(
492496
}
493497

494498
syncManager, err := synchronizer.NewSynchronizerManager(
495-
synchronizer.NewLocal(localConfig, splitAPI, splitStorage, segmentStorage, logger, telemetryStorage, dummyHC),
499+
synchronizer.NewLocal(localConfig, splitAPI, splitStorage, segmentStorage, ruleBasedSegmentStorage, logger, telemetryStorage, dummyHC),
496500
logger,
497501
config.AdvancedConfig{StreamingEnabled: false},
498502
nil,
@@ -518,6 +522,7 @@ func setupLocalhostFactory(
518522
splits: splitStorage,
519523
impressions: mutexqueue.NewMQImpressionsStorage(cfg.Advanced.ImpressionsQueueSize, make(chan string, 1), logger, telemetryStorage),
520524
events: mutexqueue.NewMQEventsStorage(cfg.Advanced.EventsQueueSize, make(chan string, 1), logger, telemetryStorage),
525+
ruleBasedSegments: ruleBasedSegmentStorage,
521526
segments: segmentStorage,
522527
initTelemetry: telemetryStorage,
523528
evaluationTelemetry: telemetryStorage,

splitio/client/input_validator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func TestValidatorOnDestroy(t *testing.T) {
356356
logger := getMockedLogger()
357357
localConfig := &synchronizer.LocalConfig{RefreshEnabled: false}
358358
sync, _ := synchronizer.NewSynchronizerManager(
359-
synchronizer.NewLocal(localConfig, &api.SplitAPI{}, mocks.MockSplitStorage{}, mocks.MockSegmentStorage{}, logger, telemetryMockedStorage, &application.Dummy{}),
359+
synchronizer.NewLocal(localConfig, &api.SplitAPI{}, mocks.MockSplitStorage{}, mocks.MockSegmentStorage{}, &mocks.MockRuleBasedSegmentStorage{}, logger, telemetryMockedStorage, &application.Dummy{}),
360360
logger,
361361
commonsCfg.AdvancedConfig{},
362362
authMocks.MockAuthClient{},
@@ -533,7 +533,7 @@ func TestInMemoryFactoryFlagSets(t *testing.T) {
533533
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
534534
switch r.URL.Path {
535535
case "/splitChanges":
536-
if r.RequestURI != "/splitChanges?s=1.1&since=-1&sets=a%2Cc%2Cd" {
536+
if r.RequestURI != "/splitChanges?s=1.3&since=-1&rbSince=-1&sets=a%2Cc%2Cd" {
537537
t.Error("wrong RequestURI for flag sets")
538538
}
539539
fmt.Fprintln(w, fmt.Sprintf(string(splitsMock), splitMock))

testdata/splits.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"till":300,"since":-1,"splits":[{"changeNumber":1660326991072,"trafficTypeName":"user","name":"feature_flag_1","trafficAllocation":100,"trafficAllocationSeed":-1364119282,"seed":-605938843,"status":"ACTIVE","killed":false,"defaultTreatment":"off","algo":2,"conditions":[{"conditionType":"ROLLOUT","matcherGroup":{"combiner":"AND","matchers":[{"keySelector":{"trafficType":"user","attribute":null},"matcherType":"ALL_KEYS","negate":false,"userDefinedSegmentMatcherData":null,"whitelistMatcherData":null,"unaryNumericMatcherData":null,"betweenMatcherData":null,"dependencyMatcherData":null,"booleanMatcherData":null,"stringMatcherData":null}]},"partitions":[{"treatment":"on","size":100},{"treatment":"off","size":0}],"label":"default rule"}],"configurations":{}},{"changeNumber":1683928900842,"trafficTypeName":"user","name":"feature_flag_2","trafficAllocation":100,"trafficAllocationSeed":-29637986,"seed":651776645,"status":"ACTIVE","killed":false,"defaultTreatment":"off","algo":2,"conditions":[{"conditionType":"WHITELIST","matcherGroup":{"combiner":"AND","matchers":[{"keySelector":null,"matcherType":"IN_SEGMENT","negate":false,"userDefinedSegmentMatcherData":{"segmentName":"segment_1"},"whitelistMatcherData":null,"unaryNumericMatcherData":null,"betweenMatcherData":null,"dependencyMatcherData":null,"booleanMatcherData":null,"stringMatcherData":null}]},"partitions":[{"treatment":"some_treatment","size":100}],"label":"whitelisted segment"},{"conditionType":"ROLLOUT","matcherGroup":{"combiner":"AND","matchers":[{"keySelector":{"trafficType":"user","attribute":null},"matcherType":"ALL_KEYS","negate":false,"userDefinedSegmentMatcherData":null,"whitelistMatcherData":null,"unaryNumericMatcherData":null,"betweenMatcherData":null,"dependencyMatcherData":null,"booleanMatcherData":null,"stringMatcherData":null}]},"partitions":[{"treatment":"on","size":100},{"treatment":"off","size":0},{"treatment":"some_treatment","size":0}],"label":"default rule"}],"configurations":{"off":"{\"color\":\"blue\"}","on":"{\"color\":\"red\"}","some_treatment":"{\"color\":\"white\"}"}},{"changeNumber":1637270255857,"trafficTypeName":"user","name":"feature_flag_3","trafficAllocation":100,"trafficAllocationSeed":-1680947654,"seed":-109151416,"status":"ACTIVE","killed":false,"algo":2},{"changeNumber":1660326991079,"trafficTypeName":"user","name":"feature_flag_4","trafficAllocation":100,"trafficAllocationSeed":-1680947654,"seed":-109151416,"status":"ACTIVE","killed":true,"algo":2}]}
1+
{"ff":{"d":[{"changeNumber":1660326991072,"trafficTypeName":"user","name":"feature_flag_1","trafficAllocation":100,"trafficAllocationSeed":-1364119282,"seed":-605938843,"status":"ACTIVE","killed":false,"defaultTreatment":"off","algo":2,"conditions":[{"conditionType":"ROLLOUT","matcherGroup":{"combiner":"AND","matchers":[{"keySelector":{"trafficType":"user","attribute":null},"matcherType":"ALL_KEYS","negate":false,"userDefinedSegmentMatcherData":null,"whitelistMatcherData":null,"unaryNumericMatcherData":null,"betweenMatcherData":null,"dependencyMatcherData":null,"booleanMatcherData":null,"stringMatcherData":null}]},"partitions":[{"treatment":"on","size":100},{"treatment":"off","size":0}],"label":"default rule"}],"configurations":{}},{"changeNumber":1683928900842,"trafficTypeName":"user","name":"feature_flag_2","trafficAllocation":100,"trafficAllocationSeed":-29637986,"seed":651776645,"status":"ACTIVE","killed":false,"defaultTreatment":"off","algo":2,"conditions":[{"conditionType":"WHITELIST","matcherGroup":{"combiner":"AND","matchers":[{"keySelector":null,"matcherType":"IN_SEGMENT","negate":false,"userDefinedSegmentMatcherData":{"segmentName":"segment_1"},"whitelistMatcherData":null,"unaryNumericMatcherData":null,"betweenMatcherData":null,"dependencyMatcherData":null,"booleanMatcherData":null,"stringMatcherData":null}]},"partitions":[{"treatment":"some_treatment","size":100}],"label":"whitelisted segment"},{"conditionType":"ROLLOUT","matcherGroup":{"combiner":"AND","matchers":[{"keySelector":{"trafficType":"user","attribute":null},"matcherType":"ALL_KEYS","negate":false,"userDefinedSegmentMatcherData":null,"whitelistMatcherData":null,"unaryNumericMatcherData":null,"betweenMatcherData":null,"dependencyMatcherData":null,"booleanMatcherData":null,"stringMatcherData":null}]},"partitions":[{"treatment":"on","size":100},{"treatment":"off","size":0},{"treatment":"some_treatment","size":0}],"label":"default rule"}],"configurations":{"off":"{\"color\":\"blue\"}","on":"{\"color\":\"red\"}","some_treatment":"{\"color\":\"white\"}"}},{"changeNumber":1637270255857,"trafficTypeName":"user","name":"feature_flag_3","trafficAllocation":100,"trafficAllocationSeed":-1680947654,"seed":-109151416,"status":"ACTIVE","killed":false,"algo":2},{"changeNumber":1660326991079,"trafficTypeName":"user","name":"feature_flag_4","trafficAllocation":100,"trafficAllocationSeed":-1680947654,"seed":-109151416,"status":"ACTIVE","killed":true,"algo":2}],"s":-1,"t":300}}

testdata/splits_mock.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
{
2-
"splits": [%s],
3-
"since": 1491244291288,
4-
"till": 1491244291288
1+
{"ff": {
2+
"d": [%s],
3+
"s": 1491244291288,
4+
"t": 1491244291288
5+
}
56
}

testdata/splits_mock_2.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"splits": [
2+
"ff": {
3+
"d": [
34
{
45
"trafficTypeName": "user",
56
"name": "DEMO_MURMUR2",
@@ -142,7 +143,8 @@
142143
}
143144
]
144145
}
145-
],
146-
"since": 1491244291288,
147-
"till": 1491244291288
146+
],
147+
"s": 1491244291288,
148+
"t": 1491244291288
149+
}
148150
}

testdata/splits_mock_3.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"splits": [
2+
"ff": {
3+
"d": [
34
{
45
"trafficTypeName": "user",
56
"name": "semver",
@@ -313,7 +314,8 @@
313314
}
314315
]
315316
}
316-
],
317-
"since": 1491244291288,
318-
"till": 1491244291288
319-
}
317+
],
318+
"s": 1491244291288,
319+
"t": 1491244291288
320+
}
321+
}

0 commit comments

Comments
 (0)