Incorrect read preference when parentId refers to NodeDocument.NULL
Add ignored test
@@ -28,11 +28,13 @@ import org.apache.jackrabbit.oak.plugins.document.MongoUtils;
import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
import org.apache.jackrabbit.oak.stats.Clock;
import org.junit.After;
+import org.junit.Ignore;
import org.junit.Test;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
import static org.apache.jackrabbit.oak.plugins.document.Collection.SETTINGS;
import static org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore.DocumentReadPreference;
+import static org.apache.jackrabbit.oak.plugins.document.util.Utils.getIdFromPath;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -126,6 +128,17 @@ public class ReadPreferenceIT extends AbstractMongoConnectionTest {
assertEquals(ReadPreference.secondary(), mongoDS.getConfiguredReadPreference(NODES));
}
+ @Ignore("OAK-8060")
+ @Test
+ public void getMongoReadPreference() {
+ String id = getIdFromPath("/does/not/exist");
+ mongoDS.setReadWriteMode(rwMode(ReadPreference.secondaryPreferred()));
+ mongoDS.find(NODES, id);
+ ReadPreference readPref = mongoDS.getMongoReadPreference(NODES, id,
+ DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH);
+ assertEquals(ReadPreference.primary(), readPref);
+ }
+
private static String rwMode(ReadPreference preference) {
return "readpreference=" + preference.getName();
}
