diff --git a/Split.xcodeproj/project.pbxproj b/Split.xcodeproj/project.pbxproj index 361c8935a..3994189dc 100644 --- a/Split.xcodeproj/project.pbxproj +++ b/Split.xcodeproj/project.pbxproj @@ -353,11 +353,11 @@ 59FB7C35220329B900ECC96A /* SplitFactoryBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FB7C34220329B900ECC96A /* SplitFactoryBuilderTests.swift */; }; 59FB7C3C2203795F00ECC96A /* LocalhostSplitsParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FB7C3B2203795F00ECC96A /* LocalhostSplitsParser.swift */; }; 59FB7C3E22037B9400ECC96A /* SpaceDelimitedLocalhostSplitsParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FB7C3D22037B9400ECC96A /* SpaceDelimitedLocalhostSplitsParser.swift */; }; + 5B48D8172DEA2CED00351925 /* PrerequisitesMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */; }; 5B91B8392DDE4A3B000510F0 /* SplitDTOTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B91B8382DDE4A30000510F0 /* SplitDTOTests.swift */; }; - 5BF52E032DE62F0500FEDAFE /* PrerequisitesMatcherMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */; }; - 5BF52DF62DE0B60700FEDAFE /* PrerequisitesMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */; }; 5BF52DF72DE0B60700FEDAFE /* PrerequisitesMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */; }; 5BF52DF92DE4B8D400FEDAFE /* PrerequisitesMatcherTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52DF82DE4B8CA00FEDAFE /* PrerequisitesMatcherTest.swift */; }; + 5BF52E032DE62F0500FEDAFE /* PrerequisitesMatcherMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */; }; 9500D9922C56F9BA00383593 /* HostDomainFilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9912C56F9BA00383593 /* HostDomainFilterTests.swift */; }; 9500D9A92C59297400383593 /* HostDomainFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9A82C59297400383593 /* HostDomainFilter.swift */; }; 9500D9AA2C59382000383593 /* HostDomainFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9500D9A82C59297400383593 /* HostDomainFilter.swift */; }; @@ -1558,9 +1558,9 @@ 59FB7C3B2203795F00ECC96A /* LocalhostSplitsParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalhostSplitsParser.swift; sourceTree = ""; }; 59FB7C3D22037B9400ECC96A /* SpaceDelimitedLocalhostSplitsParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpaceDelimitedLocalhostSplitsParser.swift; sourceTree = ""; }; 5B91B8382DDE4A30000510F0 /* SplitDTOTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitDTOTests.swift; sourceTree = ""; }; - 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcherMock.swift; sourceTree = ""; }; 5BF52DF52DE0B60300FEDAFE /* PrerequisitesMatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcher.swift; sourceTree = ""; }; 5BF52DF82DE4B8CA00FEDAFE /* PrerequisitesMatcherTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcherTest.swift; sourceTree = ""; }; + 5BF52E022DE62EFE00FEDAFE /* PrerequisitesMatcherMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrerequisitesMatcherMock.swift; sourceTree = ""; }; 9500D9912C56F9BA00383593 /* HostDomainFilterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostDomainFilterTests.swift; sourceTree = ""; }; 9500D9A82C59297400383593 /* HostDomainFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostDomainFilter.swift; sourceTree = ""; }; 9500D9AC2C5A918300383593 /* split_cache_v5.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = split_cache_v5.xcdatamodel; sourceTree = ""; }; @@ -4836,7 +4836,7 @@ 95B02CC628D0BDC10030EC8B /* CompressionUtil.swift in Sources */, 95B02CC728D0BDC10030EC8B /* Stopwatch.swift in Sources */, 95B02CC828D0BDC10030EC8B /* ConcurrentArrayQueue.swift in Sources */, - 5BF52DFC2DE5095800FEDAFE /* PrerequisitesMatcher.swift in Sources */, + 5B48D8172DEA2CED00351925 /* PrerequisitesMatcher.swift in Sources */, 95B02CC928D0BDC10030EC8B /* SynchronizedList.swift in Sources */, 95B02CCA28D0BDC10030EC8B /* ConcurrentSet.swift in Sources */, C539CADC2D93229D0050C732 /* EvaluationOptions.swift in Sources */, diff --git a/Split/Engine/Evaluator.swift b/Split/Engine/Evaluator.swift index 40ff0e931..8d2098103 100644 --- a/Split/Engine/Evaluator.swift +++ b/Split/Engine/Evaluator.swift @@ -97,7 +97,7 @@ class DefaultEvaluator: Evaluator { let matcher = prerequisitesMatcherFactory(split.prerequisites ?? []) if !matcher.evaluate(values: values, context: getContext()) { return EvaluationResult(treatment: defaultTreatment, - label: ImpressionsConstants.killed, + label: ImpressionsConstants.prerequisitesNotMet, changeNumber: changeNumber, configuration: split.configurations?[defaultTreatment], impressionsDisabled: split.isImpressionsDisabled()) @@ -110,8 +110,6 @@ class DefaultEvaluator: Evaluator { splitAlgo = algo } - let bucketKey = selectBucketKey(matchingKey: matchingKey, bucketingKey: bucketingKey) - guard let conditions: [Condition] = split.conditions, let trafficAllocationSeed = split.trafficAllocationSeed, let seed = split.seed else { @@ -170,9 +168,7 @@ class DefaultEvaluator: Evaluator { } private func selectBucketKey(matchingKey: String, bucketingKey: String?) -> String { - if let key = bucketingKey, !key.isEmpty() { - return key - } + if let key = bucketingKey, !key.isEmpty { return key } return matchingKey } diff --git a/SplitTests/EvaluatorTests.swift b/SplitTests/EvaluatorTests.swift index 1e6f96db7..b3c3a11e6 100644 --- a/SplitTests/EvaluatorTests.swift +++ b/SplitTests/EvaluatorTests.swift @@ -158,8 +158,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } split.algo = nil evaluator = customEvaluator(split: split) @@ -174,8 +173,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } split.algo = 2 evaluator = customEvaluator(split: split) @@ -190,8 +188,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } split.algo = 2 evaluator = customEvaluator(split: split) @@ -213,8 +210,7 @@ class EvaluatorTests: XCTestCase { var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_traffic_alloc_50_default_rule_50") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } let splitName = split.name! split.algo = 2 @@ -258,8 +254,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } let attributes = ["atributo2": ["salamin"]] split.algo = 2 @@ -275,8 +270,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } let attributes = ["atributo1": "mila"] split.algo = 2 @@ -292,8 +286,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } let attributes = ["atribute": ["papapa"]] split.algo = 2 @@ -310,8 +303,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } split.trafficAllocation = 0 split.algo = 2 @@ -339,8 +331,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } split.trafficAllocation = 100 split.algo = 2 @@ -403,8 +394,7 @@ class EvaluatorTests: XCTestCase { var result: EvaluationResult! var evaluator: Evaluator! guard let split = loadSplit(splitName: "split_sample_feature6") else { - XCTAssertTrue(false) - return + XCTFail("Test flag not found"); return } split.algo = 2 if (disabled != nil) { diff --git a/SplitTests/Integration/Api/DestroyTest.swift b/SplitTests/Integration/Api/DestroyTest.swift index ee6942ec8..dcc70f091 100644 --- a/SplitTests/Integration/Api/DestroyTest.swift +++ b/SplitTests/Integration/Api/DestroyTest.swift @@ -232,8 +232,8 @@ class DestroyTests: XCTestCase { XCTAssertEqual("off", treatmentsWithConfigBeforeDestroy?[splitName]?.treatment) XCTAssertEqual(true, trackBeforeDestroy) XCTAssertEqual(splitName, splitBeforeDestroy?.name) - XCTAssertEqual(33, splitCountBeforeDestroy) - XCTAssertEqual(33, splitNamesCountBeforeDestroy) + XCTAssertEqual(35, splitCountBeforeDestroy) + XCTAssertEqual(35, splitNamesCountBeforeDestroy) XCTAssertEqual(SplitConstants.control, treatmentAfterDestroy) XCTAssertEqual(SplitConstants.control, treatmentWithConfigAfterDestroy?.treatment) diff --git a/SplitTests/Integration/Api/SplitIntegrationTest.swift b/SplitTests/Integration/Api/SplitIntegrationTest.swift index 47d6f061f..148cd5cd6 100644 --- a/SplitTests/Integration/Api/SplitIntegrationTest.swift +++ b/SplitTests/Integration/Api/SplitIntegrationTest.swift @@ -16,7 +16,7 @@ class SplitIntegrationTests: XCTestCase { let matchingKey = "CUSTOMER_ID" let trafficType = "account" let kNeverRefreshRate = 9999999 - var splitChange: SplitChange? + var splitChange: TargetingRulesChange? var serverUrl = "localhost" var trackReqIndex = 0 var largeSegmentsError = false @@ -54,9 +54,7 @@ class SplitIntegrationTests: XCTestCase { private func buildTestDispatcher() -> HttpClientTestDispatcher { return { request in if request.isSplitEndpoint() { - return TestDispatcherResponse(code: 200, data: try? Json.encodeToJsonData( - TargetingRulesChange(featureFlags: self.splitChange!, ruleBasedSegments: RuleBasedSegmentChange(segments: [], since: -1, till: -1 - )))) + return TestDispatcherResponse(code: 200, data: try? Json.encodeToJsonData(self.splitChange)) } if request.isMySegmentsEndpoint() { @@ -172,7 +170,7 @@ class SplitIntegrationTests: XCTestCase { XCTAssertEqual(SplitConstants.control, ts1?["NO_EXISTING_FEATURE1"]) XCTAssertEqual(SplitConstants.control, ts1?["NO_EXISTING_FEATURE2"]) - XCTAssertEqual(33, splits?.count) + XCTAssertEqual(35, splits?.count) XCTAssertNotNil(s1) XCTAssertNil(s2) XCTAssertNotNil(i1) @@ -193,7 +191,140 @@ class SplitIntegrationTests: XCTestCase { semaphore.wait() factory = nil } + + // MARK: Prerequisites + func testPrerequisites() throws { + // Setup + let splitConfig: SplitClientConfig = SplitClientConfig() + splitConfig.featuresRefreshRate = 30 + splitConfig.segmentsRefreshRate = 30 + splitConfig.impressionRefreshRate = 30 + splitConfig.sdkReadyTimeOut = 60000 + splitConfig.trafficType = trafficType + splitConfig.eventsPerPush = 10 + splitConfig.eventsQueueSize = 100 + splitConfig.eventsPushRate = 999999 + splitConfig.eventsFirstPushWindow = 999 + splitConfig.logLevel = TestingHelper.testLogLevel + splitConfig.impressionsMode = "DEBUG" + splitConfig.serviceEndpoints = ServiceEndpoints.builder() + .set(sdkEndpoint: serverUrl).set(eventsEndpoint: serverUrl).build() + + let key: Key = Key(matchingKey: "123", bucketingKey: nil) + let factory = DefaultSplitFactoryBuilder().setHttpClient(httpClient).setApiKey(apiKey).setKey(key).setConfig(splitConfig).build() + let client = factory?.client + let manager = factory?.manager + + // Wait for SDK Ready.. + let sdkReadyExpectation = XCTestExpectation(description: "SDK READY Expectation") + client?.on(event: SplitEvent.sdkReady) { sdkReadyExpectation.fulfill() } + wait(for: [sdkReadyExpectation], timeout: 5) + + // Test + XCTAssertEqual(client?.getTreatment("always_on_if_prerequisite"), "off") + } + + func testPrerequisitesSplitView() throws { + + // Setup + let splitConfig: SplitClientConfig = SplitClientConfig() + splitConfig.featuresRefreshRate = 30 + splitConfig.segmentsRefreshRate = 30 + splitConfig.impressionRefreshRate = 30 + splitConfig.sdkReadyTimeOut = 60000 + splitConfig.trafficType = trafficType + splitConfig.eventsPerPush = 10 + splitConfig.eventsQueueSize = 100 + splitConfig.eventsPushRate = 999999 + splitConfig.eventsFirstPushWindow = 999 + splitConfig.logLevel = TestingHelper.testLogLevel + splitConfig.impressionsMode = "DEBUG" + splitConfig.serviceEndpoints = ServiceEndpoints.builder() + .set(sdkEndpoint: serverUrl).set(eventsEndpoint: serverUrl).build() + + let key: Key = Key(matchingKey: "mauro@split.io", bucketingKey: nil) + let factory = DefaultSplitFactoryBuilder().setHttpClient(httpClient).setApiKey(apiKey).setKey(key).setConfig(splitConfig).build() + let client = factory?.client + let manager = factory?.manager + + // Wait for SDK Ready.. + let sdkReadyExpectation = XCTestExpectation(description: "SDK READY Expectation") + client?.on(event: SplitEvent.sdkReady) { sdkReadyExpectation.fulfill() } + wait(for: [sdkReadyExpectation], timeout: 5) + + // Test + XCTAssertEqual(manager?.split(featureName: "always_on_if_prerequisite")!.prerequisites![0].flagName, "rbs_test_flag") + XCTAssertEqual(manager?.split(featureName: "always_on_if_prerequisite")!.prerequisites![0].treatments[0], "v1") + } + + func testPrerequisitesTreatmentPass() throws { + + let user = "bilal@split.io" // User IN segment + + // Setup + let splitConfig: SplitClientConfig = SplitClientConfig() + splitConfig.featuresRefreshRate = 30 + splitConfig.segmentsRefreshRate = 30 + splitConfig.impressionRefreshRate = 30 + splitConfig.sdkReadyTimeOut = 60000 + splitConfig.trafficType = trafficType + splitConfig.eventsPerPush = 10 + splitConfig.eventsQueueSize = 100 + splitConfig.eventsPushRate = 999999 + splitConfig.eventsFirstPushWindow = 999 + splitConfig.logLevel = TestingHelper.testLogLevel + splitConfig.impressionsMode = "DEBUG" + splitConfig.serviceEndpoints = ServiceEndpoints.builder() + .set(sdkEndpoint: serverUrl).set(eventsEndpoint: serverUrl).build() + + let key: Key = Key(matchingKey: user, bucketingKey: nil) + let factory = DefaultSplitFactoryBuilder().setHttpClient(httpClient).setApiKey(apiKey).setKey(key).setConfig(splitConfig).build() + let client = factory?.client + + // Wait for SDK Ready.. + let sdkReadyExpectation = XCTestExpectation(description: "SDK READY Expectation") + client?.on(event: SplitEvent.sdkReady) { sdkReadyExpectation.fulfill() } + wait(for: [sdkReadyExpectation], timeout: 5) + + // Test + XCTAssertEqual(client?.getTreatment("always_on_if_prerequisite"), "on", "'\(user)' is part of the segment in the JSON, so it met the prerequisite, therefore it should return 'on'") + } + + func testPrerequisitesTreatmentNotPass() throws { + + let user = "mauro@split.io" // User EXCLUDED from segment + + // Setup + let splitConfig: SplitClientConfig = SplitClientConfig() + splitConfig.featuresRefreshRate = 30 + splitConfig.segmentsRefreshRate = 30 + splitConfig.impressionRefreshRate = 30 + splitConfig.sdkReadyTimeOut = 60000 + splitConfig.trafficType = trafficType + splitConfig.eventsPerPush = 10 + splitConfig.eventsQueueSize = 100 + splitConfig.eventsPushRate = 999999 + splitConfig.eventsFirstPushWindow = 999 + splitConfig.logLevel = TestingHelper.testLogLevel + splitConfig.impressionsMode = "DEBUG" + splitConfig.serviceEndpoints = ServiceEndpoints.builder() + .set(sdkEndpoint: serverUrl).set(eventsEndpoint: serverUrl).build() + + let key: Key = Key(matchingKey: user, bucketingKey: nil) + let factory = DefaultSplitFactoryBuilder().setHttpClient(httpClient).setApiKey(apiKey).setKey(key).setConfig(splitConfig).build() + let client = factory?.client + + // Wait for SDK Ready.. + let sdkReadyExpectation = XCTestExpectation(description: "SDK READY Expectation") + client?.on(event: SplitEvent.sdkReady) { sdkReadyExpectation.fulfill() } + wait(for: [sdkReadyExpectation], timeout: 5) + + // Test + XCTAssertEqual(client?.getTreatment("always_on_if_prerequisite"), "off", "'\(user)' is excluded from the segment in the JSON, so it does not met the prerequisite, and should return 'off'") + } + + // MARK: Impressions func testImpressionsCount() throws { let splitConfig: SplitClientConfig = SplitClientConfig() @@ -278,6 +409,7 @@ class SplitIntegrationTests: XCTestCase { XCTAssertTrue(readyFired) } + // MARK: Segments func testReadyMyLargeSegmentsEnabledWaitMls() throws { readyMySegmentsEnabledTest(waitMls: true) } @@ -328,17 +460,19 @@ class SplitIntegrationTests: XCTestCase { XCTAssertTrue(timeOutFired == endpointError) } - - private func loadSplitsChangeFile() -> SplitChange? { + // MARK: Class Helpers + private func loadSplitsChangeFile() -> TargetingRulesChange? { let change = loadSplitChangeFile(name: "splitchanges_1") - change?.since = change?.till ?? -1 + change?.featureFlags.since = change?.featureFlags.till ?? -1 + change?.ruleBasedSegments.since = change?.ruleBasedSegments.till ?? -1 + return change } - private func loadSplitChangeFile(name fileName: String) -> SplitChange? { + private func loadSplitChangeFile(name fileName: String) -> TargetingRulesChange? { if let file = FileHelper.readDataFromFile(sourceClass: self, name: fileName, type: "json"), let change = try? Json.decodeFrom(json: file, to: TargetingRulesChange.self) { - return change.featureFlags + return change } return nil } diff --git a/SplitTests/Resources/splitchanges_1.json b/SplitTests/Resources/splitchanges_1.json index 420ef8e70..fe1dbafe1 100644 --- a/SplitTests/Resources/splitchanges_1.json +++ b/SplitTests/Resources/splitchanges_1.json @@ -2880,8 +2880,160 @@ "label":"in segment all" } ] + }, + { + "name": "always_on_if_prerequisite", + "trafficTypeName": "user", + "trafficAllocation": 100, + "trafficAllocationSeed": 1828377380, + "changeNumber": 5, + "seed": -790401604, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "prerequisites": [ + { + "n": "rbs_test_flag", + "ts": [ + "v1" + ] + } + ], + "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 + } + ] + }, + "partitions": [ + { + "treatment": "on", + "size": 100 + } + ], + "label": "always_on_if_prerequisite label" + } + ] + }, + { + "name": "rbs_test_flag", + "trafficTypeName": "user", + "trafficAllocation": 100, + "trafficAllocationSeed": 1828377380, + "seed": -286617921, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "algo": 2, + "conditions": [ + { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user" + }, + "matcherType": "IN_RULE_BASED_SEGMENT", + "negate": false, + "userDefinedSegmentMatcherData": { + "segmentName": "test_rule_based_segment" + } + } + ] + }, + "partitions": [ + { + "treatment": "v1", + "size": 100 + }, + { + "treatment": "v2", + "size": 0 + } + ], + "label": "in rule based segment test_rule_based_segment" + }, + { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user" + }, + "matcherType": "ALL_KEYS", + "negate": false + } + ] + }, + "partitions": [ + { + "treatment": "v1", + "size": 0 + }, + { + "treatment": "v2", + "size": 100 + } + ], + "label": "default rule" + } + ], + "configurations": {}, + "sets": [], + "impressionsDisabled": false } ], "s": 1506703262916, "t":1506703262916 -}, "rbs": {"s":-1, "t":-1, "d": []}} +}, "rbs": {"s":-1, "t":-1, "d": [ + { + "name": "test_rule_based_segment", + "status": "ACTIVE", + "trafficTypeName": "user", + "excluded": { + "keys": [ + "mauro@split.io", + "gaston@split.io" + ], + "segments": [] + }, + "conditions": [ + { + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user" + }, + "matcherType": "ENDS_WITH", + "negate": false, + "whitelistMatcherData": { + "whitelist": [ + "@split.io" + ] + } + } + ] + } + }] + }] +}} diff --git a/SplitTests/Resources/splits.json b/SplitTests/Resources/splits.json index 67500d653..76f5e8037 100644 --- a/SplitTests/Resources/splits.json +++ b/SplitTests/Resources/splits.json @@ -1,1343 +1,1501 @@ - [{ - "trafficTypeName": "custom", - "name": "SAMPLE_FEATURE0", - "prerequisites": [ - { "n": "flag1", "ts": ["on","v1"] }, - { "n": "flag2", "ts": ["off"] } - ], - "trafficAllocation": 100, - "trafficAllocationSeed": 1595297106, - "seed": -1332540447, - "status": "ACTIVE", - "killed": false, - "defaultTreatment": "off", - "changeNumber": 1, - "algo": 2, - "sets": ["set1", "set2"], - "impressionsDisabled": true, - "configurations": { - "t1": "{\"f1\": \"v1\"}", - "t2": "{\"f2\": \"v2\"}" - }, - "conditions": [{ - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributoNumero" - }, - "matcherType": "BETWEEN", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": { - "dataType": "NUMBER", - "start": 90, - "end": 500 - }, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] +[{ + "trafficTypeName": "custom", + "name": "SAMPLE_FEATURE0", + "prerequisites": [ + { "n": "flag1", "ts": ["on","v1"] }, + { "n": "flag2", "ts": ["off"] } + ], + "trafficAllocation": 100, + "trafficAllocationSeed": 1595297106, + "seed": -1332540447, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "changeNumber": 1, + "algo": 2, + "sets": ["set1", "set2"], + "impressionsDisabled": true, + "configurations": { + "t1": "{\"f1\": \"v1\"}", + "t2": "{\"f2\": \"v2\"}" + }, + "conditions": [{ + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributoNumero" + }, + "matcherType": "BETWEEN", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": { + "dataType": "NUMBER", + "start": 90, + "end": 500 + }, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_0", + "size": 0 + }, { + "treatment": "t2_0", + "size": 0 + }, { + "treatment": "t3_0", + "size": 0 + }, { + "treatment": "t4_0", + "size": 100 + }, { + "treatment": "t5_0", + "size": 0 + }, { + "treatment": "t6_0", + "size": 0 + }], + "label": "atributoNumero between 90 and 500" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo2" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["salamin"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_0", + "size": 100 + }, { + "treatment": "t2_0", + "size": 0 + }, { + "treatment": "t3_0", + "size": 0 + }, { + "treatment": "t4_0", + "size": 0 + }, { + "treatment": "t5_0", + "size": 0 + }, { + "treatment": "t6_0", + "size": 0 + }], + "label": "atributo2 exactly matches [salamin]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo1" + }, + "matcherType": "MATCHES_STRING", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": "mila" + }] + }, + "partitions": [{ + "treatment": "t1_0", + "size": 0 + }, { + "treatment": "t2_0", + "size": 0 + }, { + "treatment": "t3_0", + "size": 100 + }, { + "treatment": "t4_0", + "size": 0 + }, { + "treatment": "t5_0", + "size": 0 + }, { + "treatment": "t6_0", + "size": 0 + }], + "label": "atributo1 matches mila" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atribute" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["papapa"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_0", + "size": 0 + }, { + "treatment": "t2_0", + "size": 100 + }, { + "treatment": "t3_0", + "size": 0 + }, { + "treatment": "t4_0", + "size": 0 + }, { + "treatment": "t5_0", + "size": 0 + }, { + "treatment": "t6_0", + "size": 0 + }], + "label": "atribute exactly matches[papapa]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": null + }, + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_0", + "size": 0 + }, { + "treatment": "t2_0", + "size": 0 + }, { + "treatment": "t3_0", + "size": 0 + }, { + "treatment": "t4_0", + "size": 100 + }, { + "treatment": "t5_0", + "size": 0 + }, { + "treatment": "t6_0", + "size": 0 + }], + "label": "default rule" + }] + }, { + "trafficTypeName": "custom1", + "name": "SAMPLE_FEATURE1", + "trafficAllocation": 100, + "trafficAllocationSeed": 1595297106, + "seed": -1332540447, + "status": "ACTIVE", + "killed": true, + "defaultTreatment": "off", + "changeNumber": 1, + "algo": 2, + "conditions": [{ + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributoNumero" + }, + "matcherType": "BETWEEN", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": { + "dataType": "NUMBER", + "start": 90, + "end": 500 + }, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_1", + "size": 0 + }, { + "treatment": "t2_1", + "size": 0 + }, { + "treatment": "t3_1", + "size": 0 + }, { + "treatment": "t4_1", + "size": 100 + }, { + "treatment": "t5_1", + "size": 0 + }, { + "treatment": "t6_1", + "size": 0 + }], + "label": "atributoNumero between 90 and 500" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo2" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["salamin"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_1", + "size": 100 + }, { + "treatment": "t2_1", + "size": 0 + }, { + "treatment": "t3_1", + "size": 0 + }, { + "treatment": "t4_1", + "size": 0 + }, { + "treatment": "t5_1", + "size": 0 + }, { + "treatment": "t6_1", + "size": 0 + }], + "label": "atributo2 exactly matches [salamin]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo1" + }, + "matcherType": "MATCHES_STRING", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": "mila" + }] + }, + "partitions": [{ + "treatment": "t1_1", + "size": 0 + }, { + "treatment": "t2_1", + "size": 0 + }, { + "treatment": "t3_1", + "size": 0 + }, { + "treatment": "t4_1", + "size": 100 + }, { + "treatment": "t5_1", + "size": 0 + }, { + "treatment": "t6_1", + "size": 0 + }], + "label": "atributo1 matches mila" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atribute" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["papapa"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_1", + "size": 0 + }, { + "treatment": "t2_1", + "size": 100 + }, { + "treatment": "t3_1", + "size": 0 + }, { + "treatment": "t4_1", + "size": 0 + }, { + "treatment": "t5_1", + "size": 0 + }, { + "treatment": "t6_1", + "size": 0 + }], + "label": "atribute exactly matches[papapa]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": null + }, + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_1", + "size": 0 + }, { + "treatment": "t2_1", + "size": 0 + }, { + "treatment": "t3_1", + "size": 0 + }, { + "treatment": "t4_1", + "size": 100 + }, { + "treatment": "t5_1", + "size": 0 + }, { + "treatment": "t6_1", + "size": 0 + }], + "label": "default rule" + }] + }, { + "trafficTypeName": "custom", + "name": "SAMPLE_FEATURE2", + "trafficAllocation": 100, + "trafficAllocationSeed": 1595297106, + "seed": -1332540447, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "changeNumber": 1, + "algo": 2, + "configurations": { + "t1": "{\"f1\": \"v1\"}", + "t3": "{\"f3\": \"v3\"}", + "t2": "{\"f2\": \"v2\"}" + }, + "conditions": [{ + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributoNumero" + }, + "matcherType": "BETWEEN", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": { + "dataType": "NUMBER", + "start": 90, + "end": 500 + }, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_2", + "size": 0 + }, { + "treatment": "t2_2", + "size": 0 + }, { + "treatment": "t3_2", + "size": 0 + }, { + "treatment": "t4_2", + "size": 100 + }, { + "treatment": "t5_2", + "size": 0 + }, { + "treatment": "t6_2", + "size": 0 + }], + "label": "atributoNumero between 90 and 500" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo2" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["salamin"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_2", + "size": 100 + }, { + "treatment": "t2_2", + "size": 0 + }, { + "treatment": "t3_2", + "size": 0 + }, { + "treatment": "t4_2", + "size": 0 + }, { + "treatment": "t5_2", + "size": 0 + }, { + "treatment": "t6_2", + "size": 0 + }], + "label": "atributo2 exactly matches [salamin]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo1" + }, + "matcherType": "MATCHES_STRING", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": "mila" + }] + }, + "partitions": [{ + "treatment": "t1_2", + "size": 0 + }, { + "treatment": "t2_2", + "size": 0 + }, { + "treatment": "t3_2", + "size": 100 + }, { + "treatment": "t4_2", + "size": 0 + }, { + "treatment": "t5_2", + "size": 0 + }, { + "treatment": "t6_2", + "size": 0 + }], + "label": "atributo1 matches mila" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atribute" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["papapa"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_2", + "size": 0 + }, { + "treatment": "t2_2", + "size": 100 + }, { + "treatment": "t3_2", + "size": 0 + }, { + "treatment": "t4_2", + "size": 0 + }, { + "treatment": "t5_2", + "size": 0 + }, { + "treatment": "t6_2", + "size": 0 + }], + "label": "atribute exactly matches[papapa]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": null + }, + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_2", + "size": 0 + }, { + "treatment": "t2_2", + "size": 0 + }, { + "treatment": "t3_2", + "size": 0 + }, { + "treatment": "t4_2", + "size": 100 + }, { + "treatment": "t5_2", + "size": 0 + }, { + "treatment": "t6_2", + "size": 0 + }], + "label": "default rule" + }] + }, { + "trafficTypeName": "custom", + "name": "SAMPLE_FEATURE3", + "trafficAllocation": 100, + "trafficAllocationSeed": 1595297106, + "seed": -1332540447, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "changeNumber": 1, + "algo": 2, + "conditions": [{ + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributoNumero" + }, + "matcherType": "BETWEEN", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": { + "dataType": "NUMBER", + "start": 90, + "end": 500 + }, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_3", + "size": 0 + }, { + "treatment": "t2_3", + "size": 0 + }, { + "treatment": "t3_3", + "size": 0 + }, { + "treatment": "t4_3", + "size": 100 + }, { + "treatment": "t5_3", + "size": 0 + }, { + "treatment": "t6_3", + "size": 0 + }], + "label": "atributoNumero between 90 and 500" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo2" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["salamin"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_3", + "size": 100 + }, { + "treatment": "t2_3", + "size": 0 + }, { + "treatment": "t3_3", + "size": 0 + }, { + "treatment": "t4_3", + "size": 0 + }, { + "treatment": "t5_3", + "size": 0 + }, { + "treatment": "t6_3", + "size": 0 + }], + "label": "atributo2 exactly matches [salamin]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo1" + }, + "matcherType": "MATCHES_STRING", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": "mila" + }] + }, + "partitions": [{ + "treatment": "t1_3", + "size": 0 + }, { + "treatment": "t2_3", + "size": 0 + }, { + "treatment": "t3_3", + "size": 100 + }, { + "treatment": "t4_3", + "size": 0 + }, { + "treatment": "t5_3", + "size": 0 + }, { + "treatment": "t6_3", + "size": 0 + }], + "label": "atributo1 matches mila" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atribute" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["papapa"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_3", + "size": 0 + }, { + "treatment": "t2_3", + "size": 100 + }, { + "treatment": "t3_3", + "size": 0 + }, { + "treatment": "t4_3", + "size": 0 + }, { + "treatment": "t5_3", + "size": 0 + }, { + "treatment": "t6_3", + "size": 0 + }], + "label": "atribute exactly matches[papapa]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": null + }, + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_3", + "size": 0 + }, { + "treatment": "t2_3", + "size": 0 + }, { + "treatment": "t3_3", + "size": 0 + }, { + "treatment": "t4_3", + "size": 100 + }, { + "treatment": "t5_3", + "size": 0 + }, { + "treatment": "t6_3", + "size": 0 + }], + "label": "default rule" + }] + }, { + "trafficTypeName": "custom", + "name": "SAMPLE_FEATURE4", + "trafficAllocation": 100, + "trafficAllocationSeed": 1595297106, + "seed": -1332540447, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "changeNumber": 1, + "algo": 2, + "configurations": { + "t1": "{\"f1\": \"v1\"}", + "t3": "{\"f3\": \"v3\"}", + "t4": "{\"f4\": \"v4\"}", + "t2": "{\"f2\": \"v2\"}" + }, + "conditions": [{ + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributoNumero" + }, + "matcherType": "BETWEEN", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": { + "dataType": "NUMBER", + "start": 90, + "end": 500 + }, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_4", + "size": 0 + }, { + "treatment": "t2_4", + "size": 0 + }, { + "treatment": "t3_4", + "size": 0 + }, { + "treatment": "t4_4", + "size": 100 + }, { + "treatment": "t5_4", + "size": 0 + }, { + "treatment": "t6_4", + "size": 0 + }], + "label": "atributoNumero between 90 and 500" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo2" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["salamin"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_4", + "size": 100 + }, { + "treatment": "t2_4", + "size": 0 + }, { + "treatment": "t3_4", + "size": 0 + }, { + "treatment": "t4_4", + "size": 100 + }, { + "treatment": "t5_4", + "size": 0 + }, { + "treatment": "t6_4", + "size": 0 + }], + "label": "atributo2 exactly matches [salamin]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo1" + }, + "matcherType": "MATCHES_STRING", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": "mila" + }] + }, + "partitions": [{ + "treatment": "t1_4", + "size": 0 + }, { + "treatment": "t2_4", + "size": 0 + }, { + "treatment": "t3_4", + "size": 100 + }, { + "treatment": "t4_4", + "size": 0 + }, { + "treatment": "t5_4", + "size": 0 + }, { + "treatment": "t6_4", + "size": 0 + }], + "label": "atributo1 matches mila" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atribute" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["papapa"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_4", + "size": 0 + }, { + "treatment": "t2_4", + "size": 100 + }, { + "treatment": "t3_4", + "size": 0 + }, { + "treatment": "t4_4", + "size": 0 + }, { + "treatment": "t5_4", + "size": 0 + }, { + "treatment": "t6_4", + "size": 0 + }], + "label": "atribute exactly matches[papapa]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": null + }, + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_4", + "size": 0 + }, { + "treatment": "t2_4", + "size": 0 + }, { + "treatment": "t3_4", + "size": 0 + }, { + "treatment": "t4_4", + "size": 100 + }, { + "treatment": "t5_4", + "size": 0 + }, { + "treatment": "t6_4", + "size": 0 + }], + "label": "default rule" + }] + }, { + "trafficTypeName": "custom", + "name": "SAMPLE_FEATURE5", + "trafficAllocation": 100, + "trafficAllocationSeed": 1595297106, + "seed": -1332540447, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "changeNumber": 1, + "algo": 2, + "conditions": [{ + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributoNumero" + }, + "matcherType": "BETWEEN", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": { + "dataType": "NUMBER", + "start": 90, + "end": 500 + }, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_5", + "size": 100 + }, { + "treatment": "t2_5", + "size": 0 + }, { + "treatment": "t3_5", + "size": 0 + }, { + "treatment": "t4_5", + "size": 0 + }, { + "treatment": "t5_5", + "size": 0 + }, { + "treatment": "t6_5", + "size": 0 + }], + "label": "atributoNumero between 3 and 30" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo2" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["salamin"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_5", + "size": 0 + }, { + "treatment": "t2_5", + "size": 0 + }, { + "treatment": "t3_5", + "size": 0 + }, { + "treatment": "t4_5", + "size": 100 + }, { + "treatment": "t5_5", + "size": 0 + }, { + "treatment": "t6_5", + "size": 0 + }], + "label": "atributo2 exactly matches [salamin]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atributo1" + }, + "matcherType": "MATCHES_STRING", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": "mila" + }] + }, + "partitions": [{ + "treatment": "t1_5", + "size": 0 + }, { + "treatment": "t2_5", + "size": 0 + }, { + "treatment": "t3_5", + "size": 0 + }, { + "treatment": "t4_5", + "size": 0 + }, { + "treatment": "t5_5", + "size": 100 + }, { + "treatment": "t6_5", + "size": 0 + }], + "label": "atributo1 matches mila" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": "atribute" + }, + "matcherType": "EQUAL_TO_SET", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": { + "whitelist": ["papapa"] + }, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_5", + "size": 0 + }, { + "treatment": "t2_5", + "size": 0 + }, { + "treatment": "t3_5", + "size": 100 + }, { + "treatment": "t4_5", + "size": 0 + }, { + "treatment": "t5_5", + "size": 0 + }, { + "treatment": "t6_5", + "size": 0 + }], + "label": "atribute exactly matches[papapa]" + }, { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [{ + "keySelector": { + "trafficType": "custom", + "attribute": null + }, + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null, + "booleanMatcherData": null, + "dependencyMatcherData": null, + "stringMatcherData": null + }] + }, + "partitions": [{ + "treatment": "t1_5", + "size": 0 + }, { + "treatment": "t2_5", + "size": 0 + }, { + "treatment": "t3_5", + "size": 0 + }, { + "treatment": "t4_5", + "size": 0 + }, { + "treatment": "t5_5", + "size": 0 + }, { + "treatment": "t6_5", + "size": 100 + }], + "label": "default rule" + }] + }, + { + "name": "always_on_if_prerequisite", + "trafficTypeName": "user", + "trafficAllocation": 100, + "trafficAllocationSeed": 1828377380, + "changeNumber": 5, + "seed": -790401604, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "prerequisites": [ + { + "n": "rbs_test_flag", + "ts": [ + "v1" + ] + } + ], + "conditions": [ + { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user", + "attribute": null }, - "partitions": [{ - "treatment": "t1_0", - "size": 0 - }, { - "treatment": "t2_0", - "size": 0 - }, { - "treatment": "t3_0", - "size": 0 - }, { - "treatment": "t4_0", - "size": 100 - }, { - "treatment": "t5_0", - "size": 0 - }, { - "treatment": "t6_0", - "size": 0 - }], - "label": "atributoNumero between 90 and 500" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo2" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["salamin"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] + "matcherType": "ALL_KEYS", + "negate": false, + "userDefinedSegmentMatcherData": null, + "whitelistMatcherData": null, + "unaryNumericMatcherData": null, + "betweenMatcherData": null + } + ] + }, + "partitions": [ + { + "treatment": "on", + "size": 100 + } + ], + "label": "always_on_if_prerequisite label" + } + ] + }, + { + "name": "rbs_test_flag", + "trafficTypeName": "user", + "trafficAllocation": 100, + "trafficAllocationSeed": 1828377380, + "seed": -286617921, + "status": "ACTIVE", + "killed": false, + "defaultTreatment": "off", + "algo": 2, + "conditions": [ + { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user" }, - "partitions": [{ - "treatment": "t1_0", - "size": 100 - }, { - "treatment": "t2_0", - "size": 0 - }, { - "treatment": "t3_0", - "size": 0 - }, { - "treatment": "t4_0", - "size": 0 - }, { - "treatment": "t5_0", - "size": 0 - }, { - "treatment": "t6_0", - "size": 0 - }], - "label": "atributo2 exactly matches [salamin]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo1" - }, - "matcherType": "MATCHES_STRING", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": "mila" - }] + "matcherType": "IN_RULE_BASED_SEGMENT", + "negate": false, + "userDefinedSegmentMatcherData": { + "segmentName": "test_rule_based_segment" + } + } + ] + }, + "partitions": [ + { + "treatment": "v1", + "size": 100 + }, + { + "treatment": "v2", + "size": 0 + } + ], + "label": "in rule based segment test_rule_based_segment" + }, + { + "conditionType": "ROLLOUT", + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user" }, - "partitions": [{ - "treatment": "t1_0", - "size": 0 - }, { - "treatment": "t2_0", - "size": 0 - }, { - "treatment": "t3_0", - "size": 100 - }, { - "treatment": "t4_0", - "size": 0 - }, { - "treatment": "t5_0", - "size": 0 - }, { - "treatment": "t6_0", - "size": 0 - }], - "label": "atributo1 matches mila" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atribute" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["papapa"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] + "matcherType": "ALL_KEYS", + "negate": false + } + ] + }, + "partitions": [ + { + "treatment": "v1", + "size": 0 + }, + { + "treatment": "v2", + "size": 100 + } + ], + "label": "default rule" + } + ], + "configurations": {}, + "sets": [], + "impressionsDisabled": false + } + ,{ + "rbs": { + "s": -1, + "t": 100, + "d": [ + { + "name": "test_rule_based_segment", + "status": "ACTIVE", + "trafficTypeName": "user", + "excluded": { + "keys": [ + "mauro@split.io", + "gaston@split.io" + ], + "segments": [] + }, + "conditions": [ + { + "matcherGroup": { + "combiner": "AND", + "matchers": [ + { + "keySelector": { + "trafficType": "user" }, - "partitions": [{ - "treatment": "t1_0", - "size": 0 - }, { - "treatment": "t2_0", - "size": 100 - }, { - "treatment": "t3_0", - "size": 0 - }, { - "treatment": "t4_0", - "size": 0 - }, { - "treatment": "t5_0", - "size": 0 - }, { - "treatment": "t6_0", - "size": 0 - }], - "label": "atribute exactly matches[papapa]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": null - }, - "matcherType": "ALL_KEYS", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_0", - "size": 0 - }, { - "treatment": "t2_0", - "size": 0 - }, { - "treatment": "t3_0", - "size": 0 - }, { - "treatment": "t4_0", - "size": 100 - }, { - "treatment": "t5_0", - "size": 0 - }, { - "treatment": "t6_0", - "size": 0 - }], - "label": "default rule" - }] - }, { - "trafficTypeName": "custom1", - "name": "SAMPLE_FEATURE1", - "trafficAllocation": 100, - "trafficAllocationSeed": 1595297106, - "seed": -1332540447, - "status": "ACTIVE", - "killed": true, - "defaultTreatment": "off", - "changeNumber": 1, - "algo": 2, - "conditions": [{ - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributoNumero" - }, - "matcherType": "BETWEEN", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": { - "dataType": "NUMBER", - "start": 90, - "end": 500 - }, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_1", - "size": 0 - }, { - "treatment": "t2_1", - "size": 0 - }, { - "treatment": "t3_1", - "size": 0 - }, { - "treatment": "t4_1", - "size": 100 - }, { - "treatment": "t5_1", - "size": 0 - }, { - "treatment": "t6_1", - "size": 0 - }], - "label": "atributoNumero between 90 and 500" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo2" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["salamin"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_1", - "size": 100 - }, { - "treatment": "t2_1", - "size": 0 - }, { - "treatment": "t3_1", - "size": 0 - }, { - "treatment": "t4_1", - "size": 0 - }, { - "treatment": "t5_1", - "size": 0 - }, { - "treatment": "t6_1", - "size": 0 - }], - "label": "atributo2 exactly matches [salamin]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo1" - }, - "matcherType": "MATCHES_STRING", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": "mila" - }] - }, - "partitions": [{ - "treatment": "t1_1", - "size": 0 - }, { - "treatment": "t2_1", - "size": 0 - }, { - "treatment": "t3_1", - "size": 0 - }, { - "treatment": "t4_1", - "size": 100 - }, { - "treatment": "t5_1", - "size": 0 - }, { - "treatment": "t6_1", - "size": 0 - }], - "label": "atributo1 matches mila" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atribute" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["papapa"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_1", - "size": 0 - }, { - "treatment": "t2_1", - "size": 100 - }, { - "treatment": "t3_1", - "size": 0 - }, { - "treatment": "t4_1", - "size": 0 - }, { - "treatment": "t5_1", - "size": 0 - }, { - "treatment": "t6_1", - "size": 0 - }], - "label": "atribute exactly matches[papapa]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": null - }, - "matcherType": "ALL_KEYS", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_1", - "size": 0 - }, { - "treatment": "t2_1", - "size": 0 - }, { - "treatment": "t3_1", - "size": 0 - }, { - "treatment": "t4_1", - "size": 100 - }, { - "treatment": "t5_1", - "size": 0 - }, { - "treatment": "t6_1", - "size": 0 - }], - "label": "default rule" - }] - }, { - "trafficTypeName": "custom", - "name": "SAMPLE_FEATURE2", - "trafficAllocation": 100, - "trafficAllocationSeed": 1595297106, - "seed": -1332540447, - "status": "ACTIVE", - "killed": false, - "defaultTreatment": "off", - "changeNumber": 1, - "algo": 2, - "configurations": { - "t1": "{\"f1\": \"v1\"}", - "t3": "{\"f3\": \"v3\"}", - "t2": "{\"f2\": \"v2\"}" - }, - "conditions": [{ - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributoNumero" - }, - "matcherType": "BETWEEN", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": { - "dataType": "NUMBER", - "start": 90, - "end": 500 - }, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_2", - "size": 0 - }, { - "treatment": "t2_2", - "size": 0 - }, { - "treatment": "t3_2", - "size": 0 - }, { - "treatment": "t4_2", - "size": 100 - }, { - "treatment": "t5_2", - "size": 0 - }, { - "treatment": "t6_2", - "size": 0 - }], - "label": "atributoNumero between 90 and 500" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo2" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["salamin"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_2", - "size": 100 - }, { - "treatment": "t2_2", - "size": 0 - }, { - "treatment": "t3_2", - "size": 0 - }, { - "treatment": "t4_2", - "size": 0 - }, { - "treatment": "t5_2", - "size": 0 - }, { - "treatment": "t6_2", - "size": 0 - }], - "label": "atributo2 exactly matches [salamin]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo1" - }, - "matcherType": "MATCHES_STRING", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": "mila" - }] - }, - "partitions": [{ - "treatment": "t1_2", - "size": 0 - }, { - "treatment": "t2_2", - "size": 0 - }, { - "treatment": "t3_2", - "size": 100 - }, { - "treatment": "t4_2", - "size": 0 - }, { - "treatment": "t5_2", - "size": 0 - }, { - "treatment": "t6_2", - "size": 0 - }], - "label": "atributo1 matches mila" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atribute" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["papapa"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_2", - "size": 0 - }, { - "treatment": "t2_2", - "size": 100 - }, { - "treatment": "t3_2", - "size": 0 - }, { - "treatment": "t4_2", - "size": 0 - }, { - "treatment": "t5_2", - "size": 0 - }, { - "treatment": "t6_2", - "size": 0 - }], - "label": "atribute exactly matches[papapa]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": null - }, - "matcherType": "ALL_KEYS", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_2", - "size": 0 - }, { - "treatment": "t2_2", - "size": 0 - }, { - "treatment": "t3_2", - "size": 0 - }, { - "treatment": "t4_2", - "size": 100 - }, { - "treatment": "t5_2", - "size": 0 - }, { - "treatment": "t6_2", - "size": 0 - }], - "label": "default rule" - }] - }, { - "trafficTypeName": "custom", - "name": "SAMPLE_FEATURE3", - "trafficAllocation": 100, - "trafficAllocationSeed": 1595297106, - "seed": -1332540447, - "status": "ACTIVE", - "killed": false, - "defaultTreatment": "off", - "changeNumber": 1, - "algo": 2, - "conditions": [{ - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributoNumero" - }, - "matcherType": "BETWEEN", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": { - "dataType": "NUMBER", - "start": 90, - "end": 500 - }, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_3", - "size": 0 - }, { - "treatment": "t2_3", - "size": 0 - }, { - "treatment": "t3_3", - "size": 0 - }, { - "treatment": "t4_3", - "size": 100 - }, { - "treatment": "t5_3", - "size": 0 - }, { - "treatment": "t6_3", - "size": 0 - }], - "label": "atributoNumero between 90 and 500" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo2" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["salamin"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_3", - "size": 100 - }, { - "treatment": "t2_3", - "size": 0 - }, { - "treatment": "t3_3", - "size": 0 - }, { - "treatment": "t4_3", - "size": 0 - }, { - "treatment": "t5_3", - "size": 0 - }, { - "treatment": "t6_3", - "size": 0 - }], - "label": "atributo2 exactly matches [salamin]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo1" - }, - "matcherType": "MATCHES_STRING", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": "mila" - }] - }, - "partitions": [{ - "treatment": "t1_3", - "size": 0 - }, { - "treatment": "t2_3", - "size": 0 - }, { - "treatment": "t3_3", - "size": 100 - }, { - "treatment": "t4_3", - "size": 0 - }, { - "treatment": "t5_3", - "size": 0 - }, { - "treatment": "t6_3", - "size": 0 - }], - "label": "atributo1 matches mila" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atribute" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["papapa"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_3", - "size": 0 - }, { - "treatment": "t2_3", - "size": 100 - }, { - "treatment": "t3_3", - "size": 0 - }, { - "treatment": "t4_3", - "size": 0 - }, { - "treatment": "t5_3", - "size": 0 - }, { - "treatment": "t6_3", - "size": 0 - }], - "label": "atribute exactly matches[papapa]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": null - }, - "matcherType": "ALL_KEYS", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_3", - "size": 0 - }, { - "treatment": "t2_3", - "size": 0 - }, { - "treatment": "t3_3", - "size": 0 - }, { - "treatment": "t4_3", - "size": 100 - }, { - "treatment": "t5_3", - "size": 0 - }, { - "treatment": "t6_3", - "size": 0 - }], - "label": "default rule" - }] - }, { - "trafficTypeName": "custom", - "name": "SAMPLE_FEATURE4", - "trafficAllocation": 100, - "trafficAllocationSeed": 1595297106, - "seed": -1332540447, - "status": "ACTIVE", - "killed": false, - "defaultTreatment": "off", - "changeNumber": 1, - "algo": 2, - "configurations": { - "t1": "{\"f1\": \"v1\"}", - "t3": "{\"f3\": \"v3\"}", - "t4": "{\"f4\": \"v4\"}", - "t2": "{\"f2\": \"v2\"}" - }, - "conditions": [{ - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributoNumero" - }, - "matcherType": "BETWEEN", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": { - "dataType": "NUMBER", - "start": 90, - "end": 500 - }, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_4", - "size": 0 - }, { - "treatment": "t2_4", - "size": 0 - }, { - "treatment": "t3_4", - "size": 0 - }, { - "treatment": "t4_4", - "size": 100 - }, { - "treatment": "t5_4", - "size": 0 - }, { - "treatment": "t6_4", - "size": 0 - }], - "label": "atributoNumero between 90 and 500" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo2" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["salamin"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_4", - "size": 100 - }, { - "treatment": "t2_4", - "size": 0 - }, { - "treatment": "t3_4", - "size": 0 - }, { - "treatment": "t4_4", - "size": 100 - }, { - "treatment": "t5_4", - "size": 0 - }, { - "treatment": "t6_4", - "size": 0 - }], - "label": "atributo2 exactly matches [salamin]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo1" - }, - "matcherType": "MATCHES_STRING", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": "mila" - }] - }, - "partitions": [{ - "treatment": "t1_4", - "size": 0 - }, { - "treatment": "t2_4", - "size": 0 - }, { - "treatment": "t3_4", - "size": 100 - }, { - "treatment": "t4_4", - "size": 0 - }, { - "treatment": "t5_4", - "size": 0 - }, { - "treatment": "t6_4", - "size": 0 - }], - "label": "atributo1 matches mila" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atribute" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["papapa"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_4", - "size": 0 - }, { - "treatment": "t2_4", - "size": 100 - }, { - "treatment": "t3_4", - "size": 0 - }, { - "treatment": "t4_4", - "size": 0 - }, { - "treatment": "t5_4", - "size": 0 - }, { - "treatment": "t6_4", - "size": 0 - }], - "label": "atribute exactly matches[papapa]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": null - }, - "matcherType": "ALL_KEYS", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_4", - "size": 0 - }, { - "treatment": "t2_4", - "size": 0 - }, { - "treatment": "t3_4", - "size": 0 - }, { - "treatment": "t4_4", - "size": 100 - }, { - "treatment": "t5_4", - "size": 0 - }, { - "treatment": "t6_4", - "size": 0 - }], - "label": "default rule" - }] - }, { - "trafficTypeName": "custom", - "name": "SAMPLE_FEATURE5", - "trafficAllocation": 100, - "trafficAllocationSeed": 1595297106, - "seed": -1332540447, - "status": "ACTIVE", - "killed": false, - "defaultTreatment": "off", - "changeNumber": 1, - "algo": 2, - "conditions": [{ - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributoNumero" - }, - "matcherType": "BETWEEN", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": { - "dataType": "NUMBER", - "start": 90, - "end": 500 - }, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_5", - "size": 100 - }, { - "treatment": "t2_5", - "size": 0 - }, { - "treatment": "t3_5", - "size": 0 - }, { - "treatment": "t4_5", - "size": 0 - }, { - "treatment": "t5_5", - "size": 0 - }, { - "treatment": "t6_5", - "size": 0 - }], - "label": "atributoNumero between 3 and 30" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo2" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["salamin"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_5", - "size": 0 - }, { - "treatment": "t2_5", - "size": 0 - }, { - "treatment": "t3_5", - "size": 0 - }, { - "treatment": "t4_5", - "size": 100 - }, { - "treatment": "t5_5", - "size": 0 - }, { - "treatment": "t6_5", - "size": 0 - }], - "label": "atributo2 exactly matches [salamin]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atributo1" - }, - "matcherType": "MATCHES_STRING", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": "mila" - }] - }, - "partitions": [{ - "treatment": "t1_5", - "size": 0 - }, { - "treatment": "t2_5", - "size": 0 - }, { - "treatment": "t3_5", - "size": 0 - }, { - "treatment": "t4_5", - "size": 0 - }, { - "treatment": "t5_5", - "size": 100 - }, { - "treatment": "t6_5", - "size": 0 - }], - "label": "atributo1 matches mila" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": "atribute" - }, - "matcherType": "EQUAL_TO_SET", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": { - "whitelist": ["papapa"] - }, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_5", - "size": 0 - }, { - "treatment": "t2_5", - "size": 0 - }, { - "treatment": "t3_5", - "size": 100 - }, { - "treatment": "t4_5", - "size": 0 - }, { - "treatment": "t5_5", - "size": 0 - }, { - "treatment": "t6_5", - "size": 0 - }], - "label": "atribute exactly matches[papapa]" - }, { - "conditionType": "ROLLOUT", - "matcherGroup": { - "combiner": "AND", - "matchers": [{ - "keySelector": { - "trafficType": "custom", - "attribute": null - }, - "matcherType": "ALL_KEYS", - "negate": false, - "userDefinedSegmentMatcherData": null, - "whitelistMatcherData": null, - "unaryNumericMatcherData": null, - "betweenMatcherData": null, - "booleanMatcherData": null, - "dependencyMatcherData": null, - "stringMatcherData": null - }] - }, - "partitions": [{ - "treatment": "t1_5", - "size": 0 - }, { - "treatment": "t2_5", - "size": 0 - }, { - "treatment": "t3_5", - "size": 0 - }, { - "treatment": "t4_5", - "size": 0 - }, { - "treatment": "t5_5", - "size": 0 - }, { - "treatment": "t6_5", - "size": 100 - }], - "label": "default rule" - }] - } + "matcherType": "ENDS_WITH", + "negate": false, + "whitelistMatcherData": { + "whitelist": [ + "@split.io" + ] + } + } + ] + } + } + ] + } ] +}}] diff --git a/SplitTests/SplitManagerTest.swift b/SplitTests/SplitManagerTest.swift index ff3fa6d74..c78364105 100644 --- a/SplitTests/SplitManagerTest.swift +++ b/SplitTests/SplitManagerTest.swift @@ -36,7 +36,10 @@ class SplitManagerTest: XCTestCase { for i in 0...5 { expectedSplitNames.append("sample_feature\(i)") } - XCTAssertEqual(splits.count, 6, "Split count should be 6") + expectedSplitNames.append("always_on_if_prerequisite") + expectedSplitNames.append("rbs_test_flag") + + XCTAssertEqual(splits.count, 8, "Split count should be 8") XCTAssertEqual(names.sorted().joined(separator: ",").lowercased(), expectedSplitNames.joined(separator: ","), "Loaded splits names are not correct") let splitLowercase = manager.split(featureName: "sample_feature0")