Skip to content

Commit

Permalink
Instrumented tests updates (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
gthea authored Sep 4, 2024
2 parents 5563a5a + 3e94a68 commit 5e44146
Show file tree
Hide file tree
Showing 47 changed files with 282 additions and 1,234 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apply plugin: 'kotlin-android'
apply from: 'spec.gradle'

ext {
splitVersion = '4.3.0-alpha.2'
splitVersion = '4.3.0-alpha.3'
}

android {
Expand Down
6 changes: 3 additions & 3 deletions src/androidTest/java/helper/IntegrationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static String emptyMySegments() {
}

public static String emptyAllSegments() {
return "{\"ms\":{\"k\":[],\"cn\":null},\"ls\":{\"k\":[],\"cn\":9999999999999}}";
return "{\"ms\":{\"k\":[],\"cn\":null},\"ls\":{\"k\":[],\"cn\":1702507130121}}";
}

public static String dummyAllSegments() {
Expand All @@ -177,7 +177,7 @@ public static String randomizedAllSegments() {
}

public static String dummySingleSegment(String segment) {
return "{\"ms\":{\"k\":[{\"n\":\"" + segment + "\"}],\"cn\":null},\"ls\":{\"k\":[],\"cn\":9999999999999}}";
return "{\"ms\":{\"k\":[{\"n\":\"" + segment + "\"}],\"cn\":null},\"ls\":{\"k\":[],\"cn\":1702507130121}}";
}

public static String dummyApiKey() {
Expand All @@ -201,7 +201,7 @@ public static SplitClientConfig basicConfig() {
return SplitClientConfig.builder()
.ready(30000)
.streamingEnabled(true)
.logLevel(SplitLogLevel.DEBUG)
.logLevel(SplitLogLevel.VERBOSE)
.trafficType("account")
.build();
}
Expand Down
79 changes: 37 additions & 42 deletions src/androidTest/java/tests/integration/shared/TestingData.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
package tests.integration.shared;

import io.split.android.client.service.sseclient.notifications.MySegmentChangeV2Notification;
import io.split.android.client.utils.Json;

public class TestingData {

public final static String UNBOUNDED_NOTIFICATION = "{" +
"\\\"type\\\": \\\"MY_SEGMENTS_UPDATE_V2\\\"," +
"\\\"type\\\": \\\"MEMBERSHIPS_MS_UPDATE\\\"," +
"\\\"u\\\": 0," +
"\\\"c\\\": 0," +
"\\\"d\\\": \\\"\\\"," +
"\\\"segmentName\\\": \\\"pepe\\\"," +
"\\\"changeNumber\\\": 28" +
"\\\"n\\\": [\\\"pepe\\\"]," +
"\\\"cn\\\": 28" +
"}";

public final static String SEGMENT_REMOVAL_NOTIFICATION = "{" +
"\\\"type\\\": \\\"MY_SEGMENTS_UPDATE_V2\\\"," +
"\\\"type\\\": \\\"MEMBERSHIPS_MS_UPDATE\\\"," +
"\\\"u\\\": 3," +
"\\\"c\\\": 0," +
"\\\"d\\\": \\\"\\\"," +
"\\\"segmentName\\\": \\\"segment1\\\"," +
"\\\"changeNumber\\\": 28" +
"\\\"n\\\": [\\\"segment1\\\"]," +
"\\\"cn\\\": 28" +
"}";

/**
Expand All @@ -39,36 +36,36 @@ public class TestingData {
8492584437244343049 11382796718859679607 11383137936375052427 17699699514337596928 17001541343685934583 8355202062888946034]
*/
public final static String BOUNDED_NOTIFICATION_GZIP = "{" +
"\"type\": \"MY_SEGMENTS_UPDATE_V2\"," +
"\"type\": \"MEMBERSHIPS_MS_UPDATE\"," +
"\"u\": 1," +
"\"c\": 1," +
"\"d\": \"H4sIAAAAAAAA/2IYBfgAx0A7YBTgB4wD7YABAAID7QC6g5EYy8MEMA20A+gMFAbaAYMZDPXqlGWgHTAKRsEoGAWjgCzQQFjJkKqiiPAPAQAIAAD//5L7VQwAEAAA\"" +
"}";

public final static String ESCAPED_BOUNDED_NOTIFICATION_GZIP = "{" +
"\\\"type\\\": \\\"MY_SEGMENTS_UPDATE_V2\\\"," +
"\\\"type\\\": \\\"MEMBERSHIPS_MS_UPDATE\\\"," +
"\\\"u\\\": 1," +
"\\\"c\\\": 1," +
"\\\"d\\\": \\\"H4sIAAAAAAAA/2IYBfgAx0A7YBTgB4wD7YABAAID7QC6g5EYy8MEMA20A+gMFAbaAYMZDPXqlGWgHTAKRsEoGAWjgCzQQFjJkKqiiPAPAQAIAAD//5L7VQwAEAAA\\\"" +
"}";

public final static String BOUNDED_NOTIFICATION_ZLIB = "{" +
"\"type\": \"MY_SEGMENTS_UPDATE_V2\"," +
"\"type\": \"MEMBERSHIPS_MS_UPDATE\"," +
"\"u\": 1," +
"\"c\": 2," +
"\"d\": \"eJxiGAX4AMdAO2AU4AeMA+2AAQACA+0AuoORGMvDBDANtAPoDBQG2gGDGQz16pRloB0wCkbBKBgFo4As0EBYyZCqoojwDwEACAAA//+W/QFR\"" +
"}";

public final static String ESCAPED_BOUNDED_NOTIFICATION_ZLIB = "{" +
"\\\"type\\\": \\\"MY_SEGMENTS_UPDATE_V2\\\"," +
"\\\"type\\\": \\\"MEMBERSHIPS_MS_UPDATE\\\"," +
"\\\"u\\\": 1," +
"\\\"c\\\": 2," +
"\\\"d\\\": \\\"eJxiGAX4AMdAO2AU4AeMA+2AAQACA+0AuoORGMvDBDANtAPoDBQG2gGDGQz16pRloB0wCkbBKBgFo4As0EBYyZCqoojwDwEACAAA//+W/QFR\\\"" +
"}";


public final static String ESCAPED_BOUNDED_NOTIFICATION_MALFORMED = "{" +
"\\\"type\\\": \\\"MY_SEGMENTS_UPDATE_V2\\\"," +
"\\\"type\\\": \\\"MEMBERSHIPS_MS_UPDATE\\\"," +
"\\\"u\\\": 1," +
"\\\"c\\\": 1," +
"\\\"d\\\": \\\"H4sIAAAAAAAAg5EYy8MEMA20A+//5L7VQwAEAAA\\\"" +
Expand All @@ -80,57 +77,55 @@ public class TestingData {
* = a: [key1, key2] , r: [key3, key4]
*/
public final static String KEY_LIST_NOTIFICATION_GZIP = "{" +
"\"type\": \"MY_SEGMENTS_UPDATE_V2\"," +
"\"type\": \"MEMBERSHIPS_MS_UPDATE\"," +
"\"u\": 2," +
"\"c\": 1," +
"\"d\": \"H4sIAAAAAAAA/wTAsRHDUAgD0F2ofwEIkPAqPhdZIW0uu/v97GPXHU004ULuMGrYR6XUbIjlXULPPse+dt1yhJibBODjrTmj3GJ4emduuDDP/w0AAP//18WLsl0AAAA=\"" +
"}";

public final static String ESCAPED_KEY_LIST_NOTIFICATION_GZIP = "{" +
"\\\"type\\\": \\\"MY_SEGMENTS_UPDATE_V2\\\"," +
"\\\"segmentName\\\": \\\"new_segment_added\\\"," +
"\\\"type\\\": \\\"MEMBERSHIPS_MS_UPDATE\\\"," +
"\\\"n\\\": [\\\"new_segment_added\\\"]," +
"\\\"u\\\": 2," +
"\\\"c\\\": 1," +
"\\\"d\\\": \\\"H4sIAAAAAAAA/wTAsRHDUAgD0F2ofwEIkPAqPhdZIW0uu/v97GPXHU004ULuMGrYR6XUbIjlXULPPse+dt1yhJibBODjrTmj3GJ4emduuDDP/w0AAP//18WLsl0AAAA=\\\"" +
"}";

public final static String BOUNDED_NOTIFICATION_ZLIB_2 = "{" +
"\"changeNumber\": 1629754722111, " +
"\"type\": \"MY_SEGMENTS_UPDATE_V2\"," +
"\"cn\": 1629754722111, " +
"\"type\": \"MEMBERSHIPS_MS_UPDATE\"," +
"\"u\": 1," +
"\"c\": 2," +
"\"d\": \"eJzMVk3OhDAIVdNFl9/22zVzEo8yR5mjT6LGsRTKg2LiW8yPUnjQB+2kIwM2ThTIKtVU1oknFcRzufz+YGYM/phnHW8sdPvs9EzXW2I+HFzhNyTNgCD/PpW9xpGiHD0Bw1U5HLSS644FbGZgoPovmjpmX5wAzhIxJyN7IAnFQWX1htj+LUl6ZQRV3umMqYG1LCrOJGLPV8+IidBQZFt6sOUA6CqsX5iEFY2gqufs2mfqRtsVWytRnO+iYMN7xIBqJhDqAydV+HidkGOGEJYvk4fhe/8iIukphG/XfFcfVxnMVcALCOF77qL/EU7ODepxlLST6qxFLYRdOyW8EBY4BqVjObnm3V5ZMkZIKf++8+hM7zM1Kd3aFqVZeSHzDQAA//+QUQ3a\"" +
"}";
// c: 2
// changeNumber: 1629754722111
// cn: 1629754722111
// d: "eJzMVk3OhDAIVdNFl9/22zVzEo8yR5mjT6LGsRTKg2LiW8yPUnjQB+2kIwM2ThTIKtVU1oknFcRzufz+YGYM/phnHW8sdPvs9EzXW2I+HFzhNyTNgCD/PpW9xpGiHD0Bw1U5HLSS644FbGZgoPovmjpmX5wAzhIxJyN7IAnFQWX1htj+LUl6ZQRV3umMqYG1LCrOJGLPV8+IidBQZFt6sOUA6CqsX5iEFY2gqufs2mfqRtsVWytRnO+iYMN7xIBqJhDqAydV+HidkGOGEJYvk4fhe/8iIukphG/XfFcfVxnMVcALCOF77qL/EU7ODepxlLST6qxFLYRdOyW8EBY4BqVjObnm3V5ZMkZIKf++8+hM7zM1Kd3aFqVZeSHzDQAA//+QUQ3a"
// segmentName: ""
// type: "MY_SEGMENTS_UPDATE_V2"
// n: ""
// type: "MEMBERSHIPS_MS_UPDATE"
// u: 1

public final static String DECOMPRESSED_KEY_LIST_PAYLOAD_GZIP = "{\"a\":[1573573083296714675,8482869187405483569],\"r\":[8031872927333060586,6829471020522910836]}";

public static String encodedKeyListPayloadGzip() {
return (Json.fromJson(KEY_LIST_NOTIFICATION_GZIP, MySegmentChangeV2Notification.class)).getData();
}

public static String encodedBoundedPayloadZlib() {
return (Json.fromJson(BOUNDED_NOTIFICATION_ZLIB, MySegmentChangeV2Notification.class)).getData();
}

public static String encodedBoundedPayloadZlib2() {
return (Json.fromJson(BOUNDED_NOTIFICATION_ZLIB_2, MySegmentChangeV2Notification.class)).getData();
}

public static String encodedBoundedPayloadGzip() {
return (Json.fromJson(BOUNDED_NOTIFICATION_GZIP, MySegmentChangeV2Notification.class)).getData();
public static String segmentsUnboundedNoCompression(String intervalMs) {
return "{" +
"\\\"type\\\":\\\"MEMBERSHIPS_MS_UPDATE\\\"" +
",\\\"cn\\\":1702507130121," +
"\\\"n\\\":[\\\"android_test\\\",\\\"ios_test\\\"]," +
"\\\"c\\\":0," +
"\\\"u\\\":0," +
"\\\"d\\\":\\\"\\\"," +
"\\\"i\\\":" + intervalMs + "," +
"\\\"h\\\":0," +
"\\\"s\\\":0" +
"}";
}

public static String largeSegmentsUnboundedNoCompression(String intervalMs) {
return "{" +
"\\\"type\\\":\\\"MY_LARGE_SEGMENT_UPDATE\\\"" +
",\\\"changeNumber\\\":1702507130121," +
"\\\"largeSegments\\\":[\\\"android_test\\\",\\\"ios_test\\\"]," +
"\\\"type\\\":\\\"MEMBERSHIPS_LS_UPDATE\\\"" +
",\\\"cn\\\":1702507130121," +
"\\\"n\\\":[\\\"android_test\\\",\\\"ios_test\\\"]," +
"\\\"c\\\":0," +
"\\\"u\\\":0," +
"\\\"d\\\":\\\"\\\"," +
Expand All @@ -142,9 +137,9 @@ public static String largeSegmentsUnboundedNoCompression(String intervalMs) {

public static String largeSegmentsRemoval() {
return "{" +
"\\\"type\\\":\\\"MY_LARGE_SEGMENT_UPDATE\\\"" +
",\\\"changeNumber\\\":1702507130121," +
"\\\"largeSegments\\\":[\\\"large-segment1\\\",\\\"large-segment2\\\"]," +
"\\\"type\\\":\\\"MEMBERSHIPS_LS_UPDATE\\\"" +
",\\\"cn\\\":1702507130121," +
"\\\"n\\\":[\\\"large-segment1\\\",\\\"large-segment2\\\"]," +
"\\\"c\\\":0," +
"\\\"u\\\":3," +
"\\\"d\\\":\\\"\\\"," +
Expand Down
Loading

0 comments on commit 5e44146

Please sign in to comment.