Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
gthea committed Dec 12, 2024
1 parent 89f2ece commit 8d8e161
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
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
5 changes: 0 additions & 5 deletions src/main/java/io/split/android/client/SplitFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,6 @@ private void setupValidations(SplitClientConfig splitClientConfig) {
ValidationConfig.getInstance().setTrackEventNamePattern(splitClientConfig.trackEventNamePattern());
}

private void cleanUpDabase(SplitTaskExecutor splitTaskExecutor,
SplitTaskFactory splitTaskFactory) {
splitTaskExecutor.submit(splitTaskFactory.createCleanUpDatabaseTask(System.currentTimeMillis() / 1000), null);
}

private EventsTracker buildEventsTracker() {
EventValidator eventsValidator = new EventValidatorImpl(new KeyValidatorImpl(), mStorageContainer.getSplitsStorage());
return new EventsTrackerImpl(eventsValidator, new ValidationMessageLoggerImpl(), mStorageContainer.getTelemetryStorage(),
Expand Down

0 comments on commit 8d8e161

Please sign in to comment.