[ https://issues.apache.org/jira/browse/GEODE-3308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102157#comment-16102157 ]
ASF GitHub Bot commented on GEODE-3308: --------------------------------------- Github user ladyVader commented on a diff in the pull request: https://github.com/apache/geode/pull/659#discussion_r129672503 --- Diff: geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneSearchWithRollingUpgradeDUnit.java --- @@ -0,0 +1,1044 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.cache.lucene; + +import static org.apache.geode.test.dunit.Assert.fail; +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.io.FileUtils; +import org.apache.logging.log4j.Logger; +import org.awaitility.Awaitility; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import org.apache.geode.cache.GemFireCache; +import org.apache.geode.cache.RegionShortcut; +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; +import org.apache.geode.cache.client.ClientRegionFactory; +import org.apache.geode.cache.client.ClientRegionShortcut; +import org.apache.geode.cache.server.CacheServer; +import org.apache.geode.cache30.CacheSerializableRunnable; +import org.apache.geode.distributed.Locator; +import org.apache.geode.distributed.internal.DistributionConfig; +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.internal.Version; +import org.apache.geode.internal.cache.GemFireCacheImpl; +import org.apache.geode.internal.logging.LogService; +import org.apache.geode.test.dunit.DistributedTestUtils; +import org.apache.geode.test.dunit.Host; +import org.apache.geode.test.dunit.IgnoredException; +import org.apache.geode.test.dunit.Invoke; +import org.apache.geode.test.dunit.NetworkUtils; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase; +import org.apache.geode.test.dunit.standalone.DUnitLauncher; +import org.apache.geode.test.dunit.standalone.VersionManager; +import org.apache.geode.test.junit.categories.BackwardCompatibilityTest; +import org.apache.geode.test.junit.categories.DistributedTest; +import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory; + +@Category({DistributedTest.class, BackwardCompatibilityTest.class}) +@RunWith(Parameterized.class) +@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class) +public class LuceneSearchWithRollingUpgradeDUnit extends JUnit4DistributedTestCase { + + + @Parameterized.Parameters + public static Collection<String> data() { + List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent(); + // Lucene Compatibility checks start with Apache Geode v1.2.0 + // Removing the versions older than v1.2.0 + result.removeIf(s -> Integer.parseInt(s) < 120); + if (result.size() < 1) { + throw new RuntimeException("No older versions of Geode were found to test against"); + } else { + System.out.println("running against these versions: " + result); + } + return result; + } + + private File[] testingDirs = new File[3]; + + private static String INDEX_NAME = "index"; + + private static String diskDir = "LuceneSearchWithRollingUpgradeDUnit"; + + // Each vm will have a cache object + private static Object cache; + + // the old version of Geode we're testing against + private String oldVersion; + + private void deleteVMFiles() throws Exception { + System.out.println("deleting files in vm" + VM.getCurrentVMNum()); + File pwd = new File("."); + for (File entry : pwd.listFiles()) { + try { + if (entry.isDirectory()) { + FileUtils.deleteDirectory(entry); + } else { + entry.delete(); + } + } catch (Exception e) { + System.out.println("Could not delete " + entry + ": " + e.getMessage()); + } + } + } + + private void deleteWorkingDirFiles() throws Exception { + Invoke.invokeInEveryVM("delete files", () -> deleteVMFiles()); + } + + @Override + public void postSetUp() throws Exception { + deleteWorkingDirFiles(); + IgnoredException.addIgnoredException( + "cluster configuration service not available|ConflictingPersistentDataException"); + } + + public LuceneSearchWithRollingUpgradeDUnit(String version) { + oldVersion = version; + } + + @Test + public void fluceneQueryReturnsCorrectResultsAfterServersRollOverOnPartitionRegion() --- End diff -- Does the f in fluceneQueryReturns... mean anything or is that just a typo? > Add lucene backward compatibility and rolling upgrade dunit tests > ------------------------------------------------------------------ > > Key: GEODE-3308 > URL: https://issues.apache.org/jira/browse/GEODE-3308 > Project: Geode > Issue Type: Test > Components: lucene > Reporter: nabarun > Assignee: nabarun > -- This message was sent by Atlassian JIRA (v6.4.14#64029)