Skip to content

Commit

Permalink
ci: improve instrumented test consistency (#117)
Browse files Browse the repository at this point in the history
* ci: fix linting issue

* ci: fix testModifyMessage() flakiness
  • Loading branch information
willpassidomo authored Mar 21, 2022
1 parent 49228d6 commit 3a70121
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion android-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ dependencies {
}


//trigger the secondary core build, which will be consumed by the custom-lint module
configurations {
all {
exclude module: "httpclient"
exclude module: "commons-logging"
}
}

afterEvaluate {
android.buildTypes.all { theBuildType ->
android.sourceSets.all { sourceSet ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.IOException;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.CountDownLatch;

import static com.mparticle.identity.MParticleIdentityClientImpl.ANDROID_AAID;
Expand Down Expand Up @@ -203,13 +204,13 @@ public void makeUrlRequest(MPConnection connection, String payload, boolean mpar

@Test
public void testModifyMessage() throws Exception {
mConfigManager.setMpid(ran.nextLong(), ran.nextBoolean());
int iterations = 5;
for (int i = 0; i < iterations; i++) {
for (int i = 1; i <= iterations; i++) {
mConfigManager.setMpid(i, ran.nextBoolean());

final Map<MParticle.IdentityType, String> oldUserIdentities = mRandomUtils.getRandomUserIdentities();
final Map<MParticle.IdentityType, String> newUserIdentities = mRandomUtils.getRandomUserIdentities();

AccessUtils.clearUserIdentities((MParticleUserImpl)MParticle.getInstance().Identity().getCurrentUser());
((MParticleUserImpl)MParticle.getInstance().Identity().getCurrentUser()).setUserIdentities(oldUserIdentities);

final CountDownLatch latch = new MPLatch(1);
Expand Down Expand Up @@ -241,9 +242,9 @@ public void makeUrlRequest(MPConnection connection, String payload, boolean mpar
assertEquals(newValue, newUserIdentities.get(identityType));
}
}
setApiClient(null);
checked.value = true;
latch.countDown();
setApiClient(null);
}
}
});
Expand Down

0 comments on commit 3a70121

Please sign in to comment.