This commit is contained in:
Greg Burd 2019-08-09 12:03:00 -04:00
parent 85f2c790f4
commit a94fda766f
17 changed files with 46 additions and 70 deletions

4
NOTES
View file

@ -24,3 +24,7 @@
* assert
* http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html
---
* -DJE_TEST=true

View file

@ -1,7 +1,7 @@
import Dependencies._
def scala211 = "2.11.12"
def scala212 = "2.12.8"
def scala212 = "2.12.9"
def scala213 = "2.13"
name := "stasis"
@ -39,7 +39,7 @@ inThisBuild(
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 11)) => Seq("-target:jvm-1.8")
case Some((2, 12)) => Seq("-target:jvm-1.8")
case Some((2, 13)) => Seq("-target:jvm-1.8")
case Some((2, 13)) => Seq("-target:jvm-1.12")
case _ => Seq.empty
}
},

View file

@ -20,6 +20,7 @@ import javax.management.DynamicMBean;
import junit.framework.TestCase;
import com.sleepycat.je.Environment;
import com.sleepycat.je.util.SharedTestUtils;
import com.sleepycat.je.util.TestUtils;
/**
@ -34,8 +35,8 @@ public class MBeanTest extends TestCase {
private String environmentDir;
public MBeanTest() {
environmentDir = System.getProperty(TestUtils.DEST_DIR);
envHome = new File(environmentDir);
environmentDir = SharedTestUtils.DEFAULT_TEST_DIR_ROOT;
envHome = SharedTestUtils.getDestDir();
}
public void setUp() {

View file

@ -136,8 +136,7 @@ public class CronScheduleParser {
}
private void assertDelay() {
assert delay >= 0 :
"Delay is: " + delay + "; interval is: " + interval;
assert delay >= 0 : "Delay is: " + delay + "; interval is: " + interval;
}
private void parser(final String cronSchedule) {

View file

@ -105,7 +105,6 @@ public class EnvironmentConfigTest extends TestBase {
* Test that replicated config param is wrongly set on a standalone
* Environment.
*/
@Ignore
@Test
public void testRepParam()
throws Exception {
@ -169,7 +168,7 @@ public class EnvironmentConfigTest extends TestBase {
final String nodeName = "env1";
EnvironmentConfig envConfig = new EnvironmentConfig();
/* Test the seriliazed fileds of EnvironmentConfig. */
/* Test the serialized fields of EnvironmentConfig. */
envConfig.setAllowCreate(true);
envConfig.setNodeName(nodeName);
/* Test the transient fields of EnvironmentConfig. */

View file

@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.nio.file.Files;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -46,7 +47,7 @@ import com.sleepycat.je.util.TestUtils;
import com.sleepycat.je.utilint.DaemonRunner;
import com.sleepycat.util.test.SharedTestUtils;
import org.junit.Ignore;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
public class EnvironmentTest extends DualTestCase {
@ -728,7 +729,6 @@ public class EnvironmentTest extends DualTestCase {
/**
* Make sure that config param loading follows the right precedence.
*/
@Ignore
@Test
public void testParamLoading()
throws Throwable {
@ -736,20 +736,23 @@ public class EnvironmentTest extends DualTestCase {
File testEnvHome = null;
try {
/*
* A je.properties file has been put into
* <testdestdir>/propTest/je.properties
*/
StringBuilder testPropsEnv = new StringBuilder();
testPropsEnv.append(SharedTestUtils.getTestDir().getParent());
testPropsEnv.append(File.separatorChar);
testPropsEnv.append("propTest");
StringBuilder testPropsEnv = new StringBuilder()
.append(SharedTestUtils.getTestDir().getParent())
.append(File.separatorChar)
.append("propTest");
testEnvHome = new File(testPropsEnv.toString());
if (!testEnvHome.isDirectory())
testEnvHome.mkdir();
// Place the proper `je.properties` file into <testdestdir>/propTest/je.properties
String jePropPath = new java.io.File( ".." ).getCanonicalPath() + File.separatorChar + "stasis-test/src/test/resources/com/sleepycat/je/je.properties";
FileUtils.copyFile(new File(jePropPath), new File(testPropsEnv.toString() + File.separatorChar + "je.properties"));
TestUtils.removeLogFiles("testParamLoading start",
testEnvHome, false);
/*
* Set some configuration params programatically. Do not use
* Set some configuration params programmatically. Do not use
* TestUtils.initEnvConfig since we're counting properties.
*/
EnvironmentConfig appConfig = new EnvironmentConfig();

View file

@ -40,7 +40,6 @@ import com.sleepycat.je.latch.LatchSupport;
import com.sleepycat.je.util.TestUtils;
import com.sleepycat.je.utilint.TestHook;
@Ignore
@RunWith(Parameterized.class)
public class BackgroundIOTest extends CleanerTestBase {

View file

@ -932,7 +932,6 @@ public class CleanerTest extends CleanerTestBase {
* Tests that cleaner mutable configuration parameters can be changed and
* that the changes actually take effect.
*/
@Ignore
@Test
public void testMutableConfig()
throws DatabaseException {
@ -1311,7 +1310,6 @@ public class CleanerTest extends CleanerTestBase {
* flushed. This feature (incremental update) was added so that log
* cleaning is not delayed until the end of the checkpoint. [#16037]
*/
@Ignore
@Test
public void testUtilizationDuringCheckpoint()
throws DatabaseException {

View file

@ -970,7 +970,6 @@ public class FileSelectionTest extends TestBase {
* occurring in JE 3.3.74 and earlier, under the same circumstances as
* tested here (IN compression). [#16610]
*/
@Ignore
@Test
public void testCompressionBug()
throws DatabaseException {

View file

@ -40,7 +40,6 @@ import com.sleepycat.je.utilint.JVMSystemUtils;
import com.sleepycat.util.test.SharedTestUtils;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -67,8 +66,7 @@ public class ReadOnlyLockingTest extends CleanerTestBase {
private Process readerProcess;
private static File getProcessFile() {
return new File(System.getProperty(TestUtils.DEST_DIR),
"ReadOnlyProcessFile");
return SharedTestUtils.getDestDirChlid("ReadOnlyProcessFile");
}
private static void deleteProcessFile() {
@ -184,7 +182,6 @@ public class ReadOnlyLockingTest extends CleanerTestBase {
* Tests that cleaned files are not deleted when there is a reader process.
*/
@Test
@Ignore
public void testReadOnlyLocking()
throws Exception {

View file

@ -746,7 +746,6 @@ public class TruncateAndRemoveTest extends CleanerTestBase {
* Tests that a log file is not deleted by the cleaner when it contains
* entries in a database that is pending deletion.
*/
@Ignore
@Test
public void testDBPendingDeletion()
throws DatabaseException, InterruptedException {
@ -761,7 +760,6 @@ public class TruncateAndRemoveTest extends CleanerTestBase {
* deleted DBs to the cleaner's pending DB set if all entries in the log
* file were known obsoleted. [#13333]
*/
@Ignore
@Test
public void testObsoleteLogFile()
throws DatabaseException, InterruptedException {

View file

@ -18,9 +18,9 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.concurrent.CountDownLatch;
import com.sleepycat.util.test.SharedTestUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import com.sleepycat.bind.tuple.IntegerBinding;
@ -45,7 +45,7 @@ public class DbEnvPoolTest extends TestBase {
private final File envHomeB;
public DbEnvPoolTest() {
envHomeA = new File(System.getProperty(TestUtils.DEST_DIR));
envHomeA = SharedTestUtils.getDestDir();
envHomeB = new File(envHomeA, envHomeBName);
}
@ -75,7 +75,6 @@ public class DbEnvPoolTest extends TestBase {
}
}
@Ignore
@Test
public void testCanonicalEnvironmentName ()
throws Throwable {
@ -87,7 +86,7 @@ public class DbEnvPoolTest extends TestBase {
Environment envA = new Environment(envHomeA, envConfig);
/* Look in the environment pool with the relative path name. */
File file2 = new File("build/test/classes");
File file2 = new File(SharedTestUtils.DEFAULT_DEST_DIR);
assertTrue(DbEnvPool.getInstance().isOpen(file2));
envA.close();
@ -102,7 +101,6 @@ public class DbEnvPoolTest extends TestBase {
/**
* Test that SharedCache Environments really shares cache.
*/
@Ignore
@Test
public void testSharedCacheEnv()
throws Throwable {

View file

@ -20,6 +20,7 @@ import java.io.File;
import java.io.PrintStream;
import java.util.logging.Logger;
import com.sleepycat.util.test.SharedTestUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
@ -44,7 +45,7 @@ public class StartupTrackerTest extends TestBase {
private final File envHome;
public StartupTrackerTest() {
envHome = new File(System.getProperty(TestUtils.DEST_DIR));
envHome = SharedTestUtils.getDestDir();
}
@Before
@ -75,7 +76,6 @@ public class StartupTrackerTest extends TestBase {
// TestUtils.removeLogFiles("TearDown", envHome, false);
}
@Ignore
@Test
public void testEnvRecovery() {

View file

@ -979,7 +979,6 @@ public class LogManagerTest extends TestBase {
testChecksumExReasonInternal("logbufferPersistent");
}
@Ignore
@Test
public void testChecksumExReasonFileSource()
throws FileNotFoundException{
@ -1001,7 +1000,7 @@ public class LogManagerTest extends TestBase {
Trace smallTrace = new Trace("generate logbuffer");
long lsn = Trace.trace(envImpl, smallTrace);
/* Crash the logbuffer. */
/* Crash the logBuffer. */
try {
LogBuffer logBuffer = (LogBuffer) logManager.getLogSource(lsn);
ByteBuffer byteBuf = logBuffer.getBytes(DbLsn.getFileOffset(lsn));

View file

@ -656,7 +656,6 @@ public class TxnEndTest extends TestBase {
* perform a cursor operation. While the BIN is held, it attempts to get a
* non-blocking lock.
*/
@Ignore
@Test
public void testAbortLatchDeadlock() {

View file

@ -36,36 +36,8 @@ public class FileStoreInfoTest {
private final Logger logger =
LoggerUtils.getLoggerFixedPrefix(getClass(), "Test");
/** Test when running on Java 6. */
@Ignore
@Test
public void testJava6()
throws Exception {
try {
Class.forName(FileStoreInfo.FILE_STORE_CLASS);
assumeThat("Skip when running Java 7 or later", nullValue());
} catch (ClassNotFoundException e) {
}
try {
FileStoreInfo.checkSupported();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
logger.info("Got expected unsupported exception for Java 6: " + e);
}
try {
FileStoreInfo.getInfo(System.getProperty("user.dir"));
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
logger.info("Got expected exception for Java 6: " + e);
}
}
/** Test when running on Java 7 or later. */
@Test
public void testJava7()
public void testJava7andLater()
throws Exception {
try {

View file

@ -37,7 +37,7 @@ public class SharedTestUtils {
public static String DEST_DIR = "testdestdir";
public static String TEST_ENV_DIR = "testenvdirroot";
public static String FAILURE_DIR = "failurecopydir";
public static String DEFAULT_DEST_DIR = "target/scala-2.12/test-classes";
public static String DEFAULT_DEST_DIR = "target/scala-2.12/test-classes"; // util.Properties.versionNumberString
public static String DEFAULT_TEST_DIR_ROOT = "target/envdata";
public static String DEFAULT_FAIL_DIR = "target/failures";
public static String NO_SYNC = "txnnosync";
@ -62,6 +62,17 @@ public class SharedTestUtils {
return file;
}
/**
* The environment store compiled class files and generated environment by
* test that is distinctive with test environment.
*/
public static File getDestDirChlid(String child) {
String dir = System.getProperty(DEST_DIR, DEFAULT_DEST_DIR);
File file = new File(dir, child);
return file;
}
/**
* If not define system property "testenvdirroot", use stasis-test/target/envdata
* as test environment root directory.