Skip to content

Commit f9e24ed

Browse files
Remove LS configs and unify endpoint
1 parent 049ee4e commit f9e24ed

18 files changed

+40
-317
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio",
3-
"version": "10.27.1-rc.2",
3+
"version": "10.27.1-rc.3",
44
"description": "Split SDK",
55
"files": [
66
"README.md",

src/__tests__/browserSuites/push-fallback.spec.js

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,10 @@ const config = {
5151
scheduler: {
5252
featuresRefreshRate: 0.2,
5353
segmentsRefreshRate: 0.25,
54-
largeSegmentsRefreshRate: 0.25,
5554
impressionsRefreshRate: 3000
5655
},
5756
urls: baseUrls,
5857
streamingEnabled: true,
59-
sync: {
60-
largeSegmentsEnabled: true
61-
}
6258
};
6359
const settings = settingsFactory(config);
6460

@@ -82,27 +78,26 @@ const MILLIS_DESTROY = MILLIS_STREAMING_DISABLED_CONTROL + settings.scheduler.fe
8278

8379
/**
8480
* Sequence of calls:
85-
* 0.0 secs: initial SyncAll (/splitChanges, /my(Large)Segments/nicolas), auth, SSE connection
86-
* 0.1 secs: SSE connection opened -> syncAll (/splitChanges, /my(Large)Segments/nicolas)
87-
* 0.2 secs: Streaming down (OCCUPANCY event) -> fetch due to fallback to polling (/splitChanges, /my(Large)Segments/nicolas)
81+
* 0.0 secs: initial SyncAll (/splitChanges, /mySegments/nicolas), auth, SSE connection
82+
* 0.1 secs: SSE connection opened -> syncAll (/splitChanges, /mySegments/nicolas)
83+
* 0.2 secs: Streaming down (OCCUPANCY event) -> fetch due to fallback to polling (/splitChanges, /mySegments/nicolas)
8884
* 0.3 secs: SPLIT_UPDATE event ignored
8985
* 0.4 secs: periodic fetch due to polling (/splitChanges)
90-
* 0.45 secs: periodic fetch due to polling (/my(Large)Segments/*)
91-
* 0.5 secs: Streaming up (OCCUPANCY event) -> syncAll (/splitChanges, /my(Large)Segments/nicolas)
92-
* 0.55 secs: create a new client while streaming -> initial fetch (/my(Large)Segments/marcio), auth, SSE connection and syncAll (/splitChanges, /my(Large)Segments/nicolas, /my(Large)Segments/marcio)
86+
* 0.45 secs: periodic fetch due to polling (/mySegments/nicolas)
87+
* 0.5 secs: Streaming up (OCCUPANCY event) -> syncAll (/splitChanges, /mySegments/nicolas)
88+
* 0.55 secs: create a new client while streaming -> initial fetch (/mySegments/marcio), auth, SSE connection and syncAll (/splitChanges, /mySegments/nicolas, /mySegments/marcio)
9389
* 0.6 secs: SPLIT_UPDATE event -> /splitChanges
94-
* 0.7 secs: Streaming down (CONTROL event) -> fetch due to fallback to polling (/splitChanges, /my(Large)Segments/nicolas, /my(Large)Segments/marcio)
90+
* 0.7 secs: Streaming down (CONTROL event) -> fetch due to fallback to polling (/splitChanges, /mySegments/nicolas, /mySegments/marcio)
9591
* 0.8 secs: MY_SEGMENTS_UPDATE event ignored
9692
* 0.9 secs: periodic fetch due to polling (/splitChanges)
97-
* 0.95 secs: periodic fetch due to polling (/my(Large)Segments/nicolas, /my(Large)Segments/marcio, /my(Large)Segments/facundo)
98-
* 1.0 secs: Streaming up (CONTROL event) -> syncAll (/splitChanges, /my(Large)Segments/nicolas, /my(Large)Segments/marcio, /my(Large)Segments/facundo)
93+
* 0.95 secs: periodic fetch due to polling (/mySegments/nicolas, /mySegments/marcio, /mySegments/facundo)
94+
* 1.0 secs: Streaming up (CONTROL event) -> syncAll (/splitChanges, /mySegments/nicolas, /mySegments/marcio, /mySegments/facundo)
9995
* 1.1 secs: MY_SEGMENTS_UPDATE event -> /mySegments/nicolas
100-
* 1.2 secs: Streaming down (CONTROL event) -> fetch due to fallback to polling (/splitChanges, /my(Large)Segments/nicolas, /my(Large)Segments/marcio, /my(Large)Segments/facundo)
96+
* 1.2 secs: Streaming down (CONTROL event) -> fetch due to fallback to polling (/splitChanges, /mySegments/nicolas, /mySegments/marcio, /mySegments/facundo)
10197
* 1.3 secs: STREAMING_RESET control event -> auth, SSE connection, syncAll and stop polling
10298
* 1.5 secs: STREAMING_RESET control event -> auth, SSE connection, syncAll
10399
* 1.6 secs: Streaming closed (CONTROL STREAMING_DISABLED event) -> fetch due to fallback to polling (/splitChanges, /mySegments/nicolas, /mySegments/marcio, /mySegments/facundo)
104-
* 1.8 secs: periodic fetch due to polling (/splitChanges)
105-
* 1.85 secs: periodic fetch due to polling (/myLargeSegments/*). /mySegments/* are not fetched due to update without segments
100+
* 1.8 secs: periodic fetch due to polling (/splitChanges): due to update without segments, mySegments are not fetched
106101
* 2.0 secs: periodic fetch due to polling (/splitChanges)
107102
* 2.1 secs: destroy client
108103
*/
@@ -217,10 +212,6 @@ export function testFallback(fetchMock, assert) {
217212
return { status: 200, body: authPushEnabledNicolas };
218213
});
219214

220-
// MyLargeSegments are fetched one more time than MySegments due to smart pausing of MySegments sync at the end of the test
221-
fetchMock.get({ url: url(settings, '/myLargeSegments/nicolas%40split.io'), repeat: 14 }, { status: 200, body: { myLargeSegments: [] } });
222-
fetchMock.get({ url: url(settings, '/myLargeSegments/marcio%40split.io'), repeat: 10 }, { status: 200, body: { myLargeSegments: [] } });
223-
224215
// initial split and mySegment sync
225216
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=-1'), { status: 200, body: splitChangesMock1 });
226217
fetchMock.getOnce(url(settings, '/mySegments/nicolas%40split.io'), { status: 200, body: mySegmentsNicolasMock1 });

src/__tests__/browserSuites/push-synchronization.spec.js

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ const config = {
5151
},
5252
urls: baseUrls,
5353
streamingEnabled: true,
54-
sync: {
55-
largeSegmentsEnabled: true
56-
}
5754
};
5855
const settings = settingsFactory(config);
5956

@@ -79,13 +76,13 @@ const MILLIS_SEGMENT_REMOVAL_LS = 2100;
7976
/**
8077
* Sequence of calls:
8178
* 0.0 secs: initial SyncAll (/splitChanges, /mySegments/*), auth, SSE connection
82-
* 0.1 secs: SSE connection opened -> syncAll (/splitChanges, /mySegments/*, /myLargeSegments/*)
79+
* 0.1 secs: SSE connection opened -> syncAll (/splitChanges, /mySegments/*)
8380
* 0.2 secs: SPLIT_UPDATE event -> /splitChanges
8481
* 0.3 secs: SPLIT_UPDATE event with old changeNumber
8582
* 0.4 secs: MY_SEGMENTS_UPDATE event -> /mySegments/nicolas@split.io
8683
* 0.5 secs: SPLIT_KILL event -> /splitChanges
8784
* 0.6 secs: creates a new client -> new auth and SSE connection
88-
* 0.7 secs: SSE connection opened -> syncAll (/splitChanges, /mySegments/*, /myLargeSegments/*)
85+
* 0.7 secs: SSE connection opened -> syncAll (/splitChanges, /mySegments/*)
8986
* 0.8 secs: MY_SEGMENTS_UPDATE event for new client (with payload).
9087
* 0.9 secs: MY_SEGMENTS_UPDATE event for new client (with empty payload).
9188
* 1.0 secs: creates more clients
@@ -96,8 +93,8 @@ const MILLIS_SEGMENT_REMOVAL_LS = 2100;
9693
* 1.5 secs: MY_SEGMENTS_UPDATE_V2 KeyList event.
9794
* 1.6 secs: MY_SEGMENTS_UPDATE_V2 SegmentRemoval event.
9895
* 1.7 secs: MY_LARGE_SEGMENTS_UPDATE UnboundedFetchRequest event, with 241 ms delay for 'nicolas@split.io' (hash('nicolas@split.io') % 300)
99-
* 1.941 secs: /myLargeSegments/* fetch due to unbounded MY_LARGE_SEGMENTS_UPDATE event -> SPLIT_UPDATE event
100-
* 2.1 secs: MY_LARGE_SEGMENTS_UPDATE SegmentRemoval event -> SPLIT_UPDATE event
96+
* 1.941 secs: /mySegments/* fetch due to unbounded MY_LARGE_SEGMENTS_UPDATE event -> SDK_UPDATE event
97+
* 2.2 secs: MY_LARGE_SEGMENTS_UPDATE SegmentRemoval event -> SPLIT_UPDATE event
10198
*/
10299
export function testSynchronization(fetchMock, assert) {
103100
assert.plan(44);
@@ -258,7 +255,7 @@ export function testSynchronization(fetchMock, assert) {
258255
const EXPECTED_DELAY = 241;
259256

260257
client.once(client.Event.SDK_UPDATE, () => {
261-
assert.true(nearlyEqual(Date.now() - timestampUnboundEvent, EXPECTED_DELAY), 'SDK_UPDATE after fetching myLargeSegments with a delay');
258+
assert.true(nearlyEqual(Date.now() - timestampUnboundEvent, EXPECTED_DELAY), 'SDK_UPDATE after fetching mySegments with a delay');
262259
assert.equal(client.getTreatment('in_large_segment'), 'yes', 'evaluation after myLargeSegment fetch');
263260
});
264261

@@ -267,7 +264,7 @@ export function testSynchronization(fetchMock, assert) {
267264

268265
setTimeout(() => {
269266
assert.equal(client.getTreatment('in_large_segment'), 'yes', 'evaluation before large segment removal');
270-
assert.deepEqual(sharedClients.map(c => c.getTreatment('in_large_segment')), ['no', 'no', 'no', 'no'], 'evaluation before segment removal');
267+
assert.deepEqual(sharedClients.map(c => c.getTreatment('in_large_segment')), ['no', 'no', 'no', 'no'], 'evaluation before large segment removal');
271268

272269
client.once(client.Event.SDK_UPDATE, () => {
273270
assert.equal(client.getTreatment('in_large_segment'), 'no', 'evaluation after large segment removal');
@@ -329,9 +326,8 @@ export function testSynchronization(fetchMock, assert) {
329326
if (hasNoCacheHeader(opts)) assert.fail('request must not include `Cache-Control` header');
330327
return { status: 200, body: mySegmentsNicolasMock1 };
331328
});
332-
fetchMock.getOnce(url(settings, '/myLargeSegments/nicolas%40split.io'), { status: 200, body: { myLargeSegments: [] } });
333329

334-
// split and segment sync after SSE opened
330+
// sync all after SSE opened
335331
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=1457552620999'), function (url, opts) {
336332
const lapse = Date.now() - start;
337333
assert.true(nearlyEqual(lapse, MILLIS_SSE_OPEN), 'sync after SSE connection is opened');
@@ -342,7 +338,6 @@ export function testSynchronization(fetchMock, assert) {
342338
if (hasNoCacheHeader(opts)) assert.fail('request must not include `Cache-Control` header');
343339
return { status: 200, body: mySegmentsNicolasMock1 };
344340
});
345-
fetchMock.getOnce(url(settings, '/myLargeSegments/nicolas%40split.io'), { status: 200, body: { myLargeSegments: [] } });
346341

347342
// fetch due to SPLIT_UPDATE event
348343
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=1457552620999'), function (url, opts) {
@@ -363,15 +358,13 @@ export function testSynchronization(fetchMock, assert) {
363358
return { status: 200, body: splitChangesMock4 };
364359
});
365360

366-
// initial fetch of mySegments and myLargeSegments for new client
361+
// initial fetch of mySegments for new client
367362
fetchMock.getOnce(url(settings, '/mySegments/marcio%40split.io'), function (url, opts) {
368363
if (hasNoCacheHeader(opts)) assert.fail('request must not include `Cache-Control` header');
369364
return { status: 200, body: mySegmentsMarcio };
370365
});
371-
fetchMock.getOnce(url(settings, '/myLargeSegments/marcio%40split.io'), { status: 200, body: { myLargeSegments: [] } });
372366

373-
374-
// sync after second SSE opened
367+
// sync all after second SSE opened
375368
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=1457552650000'), function (url, opts) {
376369
const lapse = Date.now() - start;
377370
assert.true(nearlyEqual(lapse, MILLIS_SECOND_SSE_OPEN), 'sync after second SSE connection is opened');
@@ -386,38 +379,27 @@ export function testSynchronization(fetchMock, assert) {
386379
if (hasNoCacheHeader(opts)) assert.fail('request must not include `Cache-Control` header');
387380
return { status: 200, body: mySegmentsMarcio };
388381
});
389-
fetchMock.get({ url: url(settings, '/myLargeSegments/nicolas%40split.io'), repeat: 2 }, { status: 200, body: { myLargeSegments: [] } });
390-
fetchMock.get({ url: url(settings, '/myLargeSegments/marcio%40split.io'), repeat: 2 }, { status: 200, body: { myLargeSegments: [] } });
391382

392-
// 3 unbounded fetch requests
383+
// 3 unbounded fetch for MY_SEGMENTS_UPDATE_V2 + 1 unbounded fetch for MY_LARGE_SEGMENTS_UPDATE
393384
fetchMock.get({ url: url(settings, '/mySegments/nicolas%40split.io'), repeat: 3 }, function (url, opts) {
394385
if (!hasNoCacheHeader(opts)) assert.fail('request must not include `Cache-Control` header');
395386
return { status: 200, body: mySegmentsNicolasMock2 };
396387
});
397-
fetchMock.get({ url: url(settings, '/mySegments/marcio%40split.io'), repeat: 3 }, function (url, opts) {
388+
fetchMock.getOnce(url(settings, '/mySegments/nicolas%40split.io'), { status: 200, body: { ...mySegmentsNicolasMock2, myLargeSegments: ['employees', 'splitters'] } });
389+
fetchMock.get({ url: url(settings, '/mySegments/marcio%40split.io'), repeat: 4 }, function (url, opts) {
398390
if (!hasNoCacheHeader(opts)) assert.fail('request must not include `Cache-Control` header');
399391
return { status: 200, body: mySegmentsMarcio };
400392
});
401393

402-
// initial fetch of mySegments and myLargeSegments for other clients + sync after third SSE opened + 3 unbounded fetch requests for mySegments
394+
// initial fetch of mySegments for other clients + sync all after third SSE opened + 3 unbounded fetch for MY_SEGMENTS_UPDATE_V2 + 1 unbounded fetch for MY_LARGE_SEGMENTS_UPDATE
403395
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=1457552650000'), { status: 200, body: { splits: [], since: 1457552650000, till: 1457552650000 } });
404-
fetchMock.get({ url: url(settings, '/mySegments/key1'), repeat: 5 }, { status: 200, body: { mySegments: [] } });
405-
fetchMock.get({ url: url(settings, '/mySegments/key3'), repeat: 5 }, { status: 200, body: { mySegments: [{ name: 'splitters' }] } });
396+
fetchMock.get({ url: url(settings, '/mySegments/key1'), repeat: 6 }, { status: 200, body: { mySegments: [] } });
397+
fetchMock.get({ url: url(settings, '/mySegments/key3'), repeat: 6 }, { status: 200, body: { mySegments: [{ name: 'splitters' }] } });
406398
fetchMock.get({ url: url(settings, `/mySegments/${bitmapTrueKey}`), repeat: 5 }, { status: 200, body: { mySegments: [] } });
407-
fetchMock.get({ url: url(settings, '/myLargeSegments/key1'), repeat: 2 }, { status: 200, body: { myLargeSegments: [] } });
408-
fetchMock.get({ url: url(settings, '/myLargeSegments/key3'), repeat: 2 }, { status: 200, body: { myLargeSegments: [] } });
409-
fetchMock.get({ url: url(settings, `/myLargeSegments/${bitmapTrueKey}`), repeat: 2 }, { status: 200, body: { myLargeSegments: [] } });
410399

411400
// bounded fetch request
412401
fetchMock.get(url(settings, `/mySegments/${bitmapTrueKey}`), { status: 200, body: { mySegments: [{ name: 'splitters' }] } });
413402

414-
// unbounded myLargeSegments fetch requests
415-
fetchMock.getOnce(url(settings, '/myLargeSegments/nicolas%40split.io'), { status: 200, body: { myLargeSegments: ['employees', 'splitters'] } });
416-
fetchMock.getOnce(url(settings, '/myLargeSegments/marcio%40split.io'), { status: 200, body: { myLargeSegments: [] } });
417-
fetchMock.getOnce(url(settings, '/myLargeSegments/key1'), { status: 200, body: { myLargeSegments: [] } });
418-
fetchMock.getOnce(url(settings, '/myLargeSegments/key3'), { status: 200, body: { myLargeSegments: [] } });
419-
fetchMock.getOnce(url(settings, `/myLargeSegments/${bitmapTrueKey}`), { status: 200, body: { myLargeSegments: [] } });
420-
421403
fetchMock.get(new RegExp('.*'), function (url) {
422404
assert.fail('unexpected GET request with url: ' + url);
423405
});

src/__tests__/browserSuites/readiness-large-segments.spec.js

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)