Skip to content

Commit e150d51

Browse files
author
Greg Soltis
authored
Merge pull request #64 from FirebasePrivate/gsoltis/no-lru
Port no-lru tag for spec tests
2 parents 0cd85ea + aafc76b commit e150d51

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

firebase-firestore/src/test/java/com/google/firebase/firestore/spec/MemorySpecTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.firebase.firestore.local.Persistence;
44
import com.google.firebase.firestore.local.PersistenceTestHelpers;
5+
import java.util.Set;
56
import org.junit.runner.RunWith;
67
import org.robolectric.RobolectricTestRunner;
78
import org.robolectric.annotation.Config;
@@ -14,4 +15,10 @@ public class MemorySpecTest extends SpecTestCase {
1415
Persistence getPersistence() {
1516
return PersistenceTestHelpers.createMemoryPersistence();
1617
}
18+
19+
@Override
20+
protected boolean shouldRun(Set<String> tags) {
21+
// There are currently no tags which disable memory persistence tests.
22+
return true;
23+
}
1724
}

firebase-firestore/src/test/java/com/google/firebase/firestore/spec/SQLiteSpecTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.firebase.firestore.local.Persistence;
44
import com.google.firebase.firestore.local.PersistenceTestHelpers;
5+
import java.util.Set;
56
import org.junit.runner.RunWith;
67
import org.robolectric.RobolectricTestRunner;
78
import org.robolectric.annotation.Config;
@@ -10,8 +11,15 @@
1011
@Config(manifest = Config.NONE)
1112
public class SQLiteSpecTest extends SpecTestCase {
1213

14+
private static final String NO_LRU_TAG = "no-lru";
15+
1316
@Override
1417
Persistence getPersistence() {
1518
return PersistenceTestHelpers.createSQLitePersistence();
1619
}
20+
21+
@Override
22+
protected boolean shouldRun(Set<String> tags) {
23+
return !tags.contains(NO_LRU_TAG);
24+
}
1725
}

firebase-firestore/src/test/java/com/google/firebase/firestore/spec/SpecTestCase.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ public static void log(String line) {
184184

185185
abstract Persistence getPersistence();
186186

187+
protected abstract boolean shouldRun(Set<String> tags);
188+
187189
private void specSetUp(JSONObject config) {
188190
log(" Clearing all state.");
189191

@@ -1010,13 +1012,13 @@ private static boolean anyTestsAreMarkedExclusive(JSONObject fileJSON) throws JS
10101012
}
10111013

10121014
/** Called before executing each test to see if it should be run. */
1013-
private static boolean shouldRunTest(Set<String> tags) throws JSONException {
1015+
private boolean shouldRunTest(Set<String> tags) throws JSONException {
10141016
for (String tag : tags) {
10151017
if (DISABLED_TAGS.contains(tag)) {
10161018
return false;
10171019
}
10181020
}
1019-
return true;
1021+
return shouldRun(tags);
10201022
}
10211023

10221024
private static Set<String> getTestTags(JSONObject testJSON) throws JSONException {

0 commit comments

Comments
 (0)