Skip to content

Commit

Permalink
Bug(session payload) match session payload versions
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartbearYing authored and YYChen01988 committed Oct 10, 2023
2 parents ecd391c + 807d6bb commit d6eade9
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 55 deletions.
28 changes: 14 additions & 14 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ steps:
- "--aws-public-ip"
- "--fail-fast"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Debug fixture smoke tests'
Expand Down Expand Up @@ -81,7 +81,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-debug"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 7 NDK r19 end-to-end tests - batch 1'
Expand Down Expand Up @@ -111,7 +111,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r19"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 7 NDK r19 end-to-end tests - batch 2'
Expand Down Expand Up @@ -141,7 +141,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r19"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 8 NDK r19 end-to-end tests - batch 1'
Expand Down Expand Up @@ -169,7 +169,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r19"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 8 NDK r19 end-to-end tests - batch 2'
Expand Down Expand Up @@ -197,7 +197,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r19"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 9 NDK r21 end-to-end tests - batch 1'
Expand Down Expand Up @@ -227,7 +227,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 9 NDK r21 end-to-end tests - batch 2'
Expand Down Expand Up @@ -257,7 +257,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 10 NDK r21 end-to-end tests - batch 1'
Expand Down Expand Up @@ -287,7 +287,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 10 NDK r21 end-to-end tests - batch 2'
Expand Down Expand Up @@ -317,7 +317,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

# Android 11+ devices have the GWP-ASAN tool enabled which randomly samples native memory
Expand Down Expand Up @@ -351,7 +351,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 11 NDK r21 end-to-end tests - batch 2'
Expand Down Expand Up @@ -381,7 +381,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 13 NDK r21 end-to-end tests - batch 1'
Expand Down Expand Up @@ -411,7 +411,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 13 NDK r21 end-to-end tests - batch 2'
Expand Down Expand Up @@ -441,7 +441,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

# If there is a tag present activate a manual publishing step
Expand Down
16 changes: 8 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r19"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 8 NDK r19 smoke tests'
Expand All @@ -148,7 +148,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r19"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 9 NDK r21 smoke tests'
Expand Down Expand Up @@ -177,7 +177,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 10 NDK r21 smoke tests'
Expand Down Expand Up @@ -206,7 +206,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 11 NDK r21 smoke tests'
Expand Down Expand Up @@ -236,7 +236,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

# Android 11+ devices have the GWP-ASAN tool enabled which randomly samples native memory
Expand Down Expand Up @@ -271,7 +271,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 12 NDK r21 end-to-end tests - batch 2'
Expand Down Expand Up @@ -302,7 +302,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 13 NDK r21 smoke tests'
Expand Down Expand Up @@ -331,7 +331,7 @@ steps:
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar-app'
concurrency_group: 'bitbar'
concurrency_method: eager

- label: 'Conditionally include device farms/full tests'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.OutputStreamWriter;
import java.io.Writer;

public class SessionV1PayloadTest {
public class SessionLegacyPayloadTest {

private File file;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.io.OutputStreamWriter
import java.io.Writer
import java.util.Date

class SessionV2V3PayloadTest {
class SessionPayloadTest {
lateinit var session: Session

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,11 @@ void setAutoCaptured(boolean autoCaptured) {
*
* @return whether the payload is v2
*/
boolean isV2Payload() {
return file != null && file.getName().endsWith("_v2.json");
}

boolean isV3Payload() {
return file != null && file.getName().endsWith("_v3.json");
boolean isLegacyPayload() {
return !(file != null &&
(file.getName().endsWith("_v2.json") || file.getName().endsWith("_v3.json")
));
}

Notifier getNotifier() {
Expand All @@ -231,10 +230,10 @@ Notifier getNotifier() {
@Override
public void toStream(@NonNull JsonStream writer) throws IOException {
if (file != null) {
if (isV2Payload() || isV3Payload()) {
serializeV2V3Payload(writer);
if (!isLegacyPayload()) {
serializePayload(writer);
} else {
serializeV1Payload(writer);
serializeLegacyPayload(writer);
}
} else {
writer.beginObject();
Expand All @@ -248,11 +247,11 @@ public void toStream(@NonNull JsonStream writer) throws IOException {
}
}

private void serializeV2V3Payload(@NonNull JsonStream writer) throws IOException {
private void serializePayload(@NonNull JsonStream writer) throws IOException {
writer.value(file);
}

private void serializeV1Payload(@NonNull JsonStream writer) throws IOException {
private void serializeLegacyPayload(@NonNull JsonStream writer) throws IOException {
writer.beginObject();
writer.name("notifier").value(notifier);
writer.name("app").value(app);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ void flushStoredSession(File storedFile) {
storedFile, client.getNotifier(), logger, configuration.getApiKey()
);

if (!payload.isV2Payload()) { // collect data here
if (payload.isLegacyPayload()) { // collect data here
payload.setApp(client.getAppDataCollector().generateApp());
payload.setDevice(client.getDeviceDataCollector().generateDevice());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,32 +106,17 @@ class SessionTest {
}

@Test
fun isV2() {
assertFalse(session.isV2Payload)
fun isLegacyPayload() {
assertTrue(session.isLegacyPayload)
val file = File("150450000000053a27e4e-967c-4e5c-91be-2e86f2eb7cdc.json")
assertFalse(Session(file, Notifier(), NoopLogger, apiKey).isV2Payload)
assertTrue(
assertTrue(Session(file, Notifier(), NoopLogger, apiKey).isLegacyPayload)
assertFalse(
Session(
File("150450000000053a27e4e-967c-4e5c-91be-2e86f2eb7cdc_v2.json"),
Notifier(),
NoopLogger,
apiKey
).isV2Payload
)
}

@Test
fun isV3() {
assertFalse(session.isV3Payload)
val file = File("150450000000053a27e4e-967c-4e5c-91be-2e86f2eb7cdc.json")
assertFalse(Session(file, Notifier(), NoopLogger, apiKey).isV3Payload)
assertTrue(
Session(
File("150450000000053a27e4e-967c-4e5c-91be-2e86f2eb7cdc_v3.json"),
Notifier(),
NoopLogger,
apiKey
).isV3Payload
).isLegacyPayload
)
}

Expand Down

0 comments on commit d6eade9

Please sign in to comment.