Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggling E2E tests #726

Merged
merged 41 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
489bc31
WIP
gthea Nov 27, 2024
a5f7c5e
New tests
gthea Nov 27, 2024
a416b0c
Cleanup
gthea Nov 27, 2024
f5373dc
WIP integration
gthea Nov 29, 2024
ba92544
Merge branch 'SDKS-9072_baseline' into SDKS-9031
gthea Nov 29, 2024
4d0b415
Tests modifications
gthea Nov 29, 2024
428bb5b
WIP
gthea Dec 2, 2024
4532d4a
Refactor
gthea Dec 2, 2024
fb3d56f
Fix tests
gthea Dec 2, 2024
ff03a85
Update tests
gthea Dec 2, 2024
015180d
Track segments sync by Key
gthea Dec 3, 2024
f4ea326
Rollout config
gthea Dec 3, 2024
a9d47fe
Fixes
gthea Dec 3, 2024
c8eefc8
WIP int tests
gthea Dec 4, 2024
f65f0ae
WIP
gthea Dec 4, 2024
48a311f
qMerge branch 'SDKS-9072_baseline' into SDKS-9040
gthea Dec 4, 2024
6234fa7
WIP
gthea Dec 5, 2024
f645892
Remove unused method
gthea Dec 5, 2024
b0b52aa
Remove unused method
gthea Dec 5, 2024
55d3cbb
Rename config
gthea Dec 5, 2024
06ce624
Emit SDK_READY_FROM_CACHE alongside SDK_READY, if not previously emitted
gthea Dec 5, 2024
57c4841
Merge branch 'SDKS-9072_baseline' into SDKS-9079
gthea Dec 5, 2024
910a82e
Fix test
gthea Dec 5, 2024
18779a1
Update version
gthea Dec 6, 2024
034f0cd
Fix test
gthea Dec 9, 2024
9f371a0
WIP
gthea Dec 9, 2024
ed204a7
WIP
gthea Dec 10, 2024
a041c52
WIP
gthea Dec 10, 2024
552b9ec
Minor changes to UC tests
gthea Dec 10, 2024
9f7f97a
Wip test changes
gthea Dec 10, 2024
4c3b592
Update recorder sync helper to handle multiple listeners
gthea Dec 10, 2024
89f2ece
Merge branch 'SDKS-9104_baseline' into SDKS-9095
gthea Dec 11, 2024
8d8e161
Fix test
gthea Dec 12, 2024
872f01e
Add trackImpressions to Split DTO
gthea Dec 11, 2024
3845f39
Add trackImpressions to SplitView
gthea Dec 12, 2024
23d0758
Decorated impression & evaluation result changes
gthea Dec 11, 2024
ad32409
WIP
gthea Dec 12, 2024
b0b321b
Fix tests comp issue
gthea Dec 12, 2024
02be21e
WIP tests
gthea Dec 13, 2024
a79d535
WIP test
gthea Dec 13, 2024
f547b3a
Better tests
gthea Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions src/androidTest/assets/split_changes_imp_toggle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"splits": [
{
"trafficTypeName": "user",
"name": "tracked",
"trafficAllocation": 100,
"trafficAllocationSeed": -285565213,
"seed": -1992295819,
"status": "ACTIVE",
"killed": false,
"defaultTreatment": "off",
"changeNumber": 1506703262916,
"algo": 2,
"trackImpressions": true,
"conditions": [
{
"conditionType": "ROLLOUT",
"matcherGroup": {
"combiner": "AND",
"matchers": [
{
"keySelector": {
"trafficType": "client",
"attribute": null
},
"matcherType": "IN_SEGMENT",
"negate": false,
"userDefinedSegmentMatcherData": {
"segmentName": "new_segment"
},
"whitelistMatcherData": null,
"unaryNumericMatcherData": null,
"betweenMatcherData": null,
"booleanMatcherData": null,
"dependencyMatcherData": null,
"stringMatcherData": null
}
]
},
"partitions": [
{
"treatment": "on",
"size": 0
},
{
"treatment": "off",
"size": 0
},
{
"treatment": "free",
"size": 100
},
{
"treatment": "conta",
"size": 0
}
],
"label": "in segment new_segment"
}
]
},
{
"trafficTypeName": "user",
"name": "not_tracked",
"trafficAllocation": 100,
"trafficAllocationSeed": -285565213,
"seed": -1992295819,
"status": "ACTIVE",
"killed": false,
"defaultTreatment": "off",
"changeNumber": 1506703262916,
"algo": 2,
"trackImpressions": false,
"conditions": [
{
"conditionType": "ROLLOUT",
"matcherGroup": {
"combiner": "AND",
"matchers": [
{
"keySelector": {
"trafficType": "client",
"attribute": null
},
"matcherType": "IN_SEGMENT",
"negate": false,
"userDefinedSegmentMatcherData": {
"segmentName": "new_segment"
},
"whitelistMatcherData": null,
"unaryNumericMatcherData": null,
"betweenMatcherData": null,
"booleanMatcherData": null,
"dependencyMatcherData": null,
"stringMatcherData": null
}
]
},
"partitions": [
{
"treatment": "on",
"size": 0
},
{
"treatment": "off",
"size": 0
},
{
"treatment": "free",
"size": 100
},
{
"treatment": "conta",
"size": 0
}
],
"label": "in segment new_segment"
}
]
}
],
"since": 1506703262916,
"till": 1506703262916
}
4 changes: 2 additions & 2 deletions src/androidTest/java/fake/SyncManagerStub.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fake;

import io.split.android.client.dtos.Event;
import io.split.android.client.impressions.Impression;
import io.split.android.client.impressions.DecoratedImpression;
import io.split.android.client.service.synchronizer.SyncManager;
import io.split.android.client.shared.UserConsent;

Expand Down Expand Up @@ -42,6 +42,6 @@ public void pushEvent(Event event) {
}

@Override
public void pushImpression(Impression impression) {
public void pushImpression(DecoratedImpression impression) {
}
}
4 changes: 2 additions & 2 deletions src/androidTest/java/fake/SynchronizerSpyImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import io.split.android.client.api.Key;
import io.split.android.client.dtos.Event;
import io.split.android.client.impressions.Impression;
import io.split.android.client.impressions.DecoratedImpression;
import io.split.android.client.service.synchronizer.Synchronizer;
import io.split.android.client.service.synchronizer.SynchronizerSpy;
import io.split.android.client.service.synchronizer.attributes.AttributesSynchronizer;
Expand Down Expand Up @@ -88,7 +88,7 @@ public void pushEvent(Event event) {
}

@Override
public void pushImpression(Impression impression) {
public void pushImpression(DecoratedImpression impression) {
mSynchronizer.pushImpression(impression);
}

Expand Down
5 changes: 4 additions & 1 deletion src/androidTest/java/helper/DatabaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ public static boolean removeDatabaseFile(String name) {
}

public static SplitRoomDatabase getTestDatabase(Context context) {
return Room.inMemoryDatabaseBuilder(context, SplitRoomDatabase.class)
SplitRoomDatabase database = Room.inMemoryDatabaseBuilder(context, SplitRoomDatabase.class)
.fallbackToDestructiveMigration()
.allowMainThreadQueries()
.build();

database.clearAllTables();
return database;
}
}
4 changes: 4 additions & 0 deletions src/androidTest/java/helper/IntegrationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,5 +442,9 @@ public interface StreamingResponseClosure {
public static class ServicePath {
public static final String MEMBERSHIPS = "memberships";
public static final String SPLIT_CHANGES = "splitChanges";
public static final String EVENTS = "events";
public static final String UNIQUE_KEYS = "keys/cs";
public static final String COUNT = "testImpressions/count";
public static final String IMPRESSIONS = "testImpressions/bulk";
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package tests.integration.streaming;

import static java.lang.Thread.sleep;

import android.content.Context;

import androidx.core.util.Pair;
Expand Down Expand Up @@ -140,7 +138,7 @@ public void testCleanUp() throws IOException, InterruptedException {
.streamingEnabled(true)
.impressionsRefreshRate(999999999)
.eventFlushInterval(99999999)
.logLevel(SplitLogLevel.DEBUG)
.logLevel(SplitLogLevel.VERBOSE)
.trafficType("account")
.build();

Expand All @@ -155,11 +153,12 @@ public void testCleanUp() throws IOException, InterruptedException {
mClient.on(SplitEvent.SDK_READY, readyTask);

latch.await(40, TimeUnit.SECONDS);

// wait to allow cleanup to run
sleep(5000);
Thread.sleep(1000);

// Load all records again after cleanup
List<UniqueKeyEntity> remainingKeys = mUniqueKeysDao.getBy(0, StorageRecordStatus.ACTIVE, 10);
remainingKeys.addAll(mUniqueKeysDao.getBy(0, StorageRecordStatus.DELETED, 10));

List<EventEntity> remainingEvents = mEventDao.getBy(0, StorageRecordStatus.ACTIVE, 10);
remainingEvents.addAll(mEventDao.getBy(0, StorageRecordStatus.DELETED, 10));

Expand All @@ -169,8 +168,6 @@ public void testCleanUp() throws IOException, InterruptedException {
List<ImpressionsCountEntity> remainingCounts = mImpressionsCountDao.getBy(0, StorageRecordStatus.ACTIVE, 10);
remainingCounts.addAll(mImpressionsCountDao.getBy(0, StorageRecordStatus.DELETED, 10));

List<UniqueKeyEntity> remainingKeys = mUniqueKeysDao.getBy(0, StorageRecordStatus.ACTIVE, 10);
remainingKeys.addAll(mUniqueKeysDao.getBy(0, StorageRecordStatus.DELETED, 10));

List<ImpressionsObserverCacheEntity> remainingImpressionsObserverCacheEntities = mImpressionsObserverCacheDao.getAll(3);

Expand All @@ -184,7 +181,6 @@ public void testCleanUp() throws IOException, InterruptedException {
Assert.assertEquals(1, remainingCounts.size());
Assert.assertEquals(1, remainingKeys.size());
Assert.assertEquals(1, remainingImpressionsObserverCacheEntities.size());

}

private EventEntity createEventEntity(long createdAt, int status, String name) {
Expand Down Expand Up @@ -258,7 +254,7 @@ public HttpResponseMock getResponse(URI uri, HttpMethod method, String body) {
} else if (uri.getPath().contains("/bulk")) {
return createResponse(500, "");
} else {
return new HttpResponseMock(200);
return new HttpResponseMock(404);
}
}

Expand Down
Loading
Loading