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 * assert
* http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html * http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html
---
* -DJE_TEST=true

View file

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

View file

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

View file

@ -136,8 +136,7 @@ public class CronScheduleParser {
} }
private void assertDelay() { private void assertDelay() {
assert delay >= 0 : assert delay >= 0 : "Delay is: " + delay + "; interval is: " + interval;
"Delay is: " + delay + "; interval is: " + interval;
} }
private void parser(final String cronSchedule) { 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 * Test that replicated config param is wrongly set on a standalone
* Environment. * Environment.
*/ */
@Ignore
@Test @Test
public void testRepParam() public void testRepParam()
throws Exception { throws Exception {
@ -169,7 +168,7 @@ public class EnvironmentConfigTest extends TestBase {
final String nodeName = "env1"; final String nodeName = "env1";
EnvironmentConfig envConfig = new EnvironmentConfig(); EnvironmentConfig envConfig = new EnvironmentConfig();
/* Test the seriliazed fileds of EnvironmentConfig. */ /* Test the serialized fields of EnvironmentConfig. */
envConfig.setAllowCreate(true); envConfig.setAllowCreate(true);
envConfig.setNodeName(nodeName); envConfig.setNodeName(nodeName);
/* Test the transient fields of EnvironmentConfig. */ /* 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 static org.junit.Assert.fail;
import java.io.File; import java.io.File;
import java.nio.file.Files;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -46,7 +47,7 @@ import com.sleepycat.je.util.TestUtils;
import com.sleepycat.je.utilint.DaemonRunner; import com.sleepycat.je.utilint.DaemonRunner;
import com.sleepycat.util.test.SharedTestUtils; import com.sleepycat.util.test.SharedTestUtils;
import org.junit.Ignore; import org.apache.commons.io.FileUtils;
import org.junit.Test; import org.junit.Test;
public class EnvironmentTest extends DualTestCase { public class EnvironmentTest extends DualTestCase {
@ -728,7 +729,6 @@ public class EnvironmentTest extends DualTestCase {
/** /**
* Make sure that config param loading follows the right precedence. * Make sure that config param loading follows the right precedence.
*/ */
@Ignore
@Test @Test
public void testParamLoading() public void testParamLoading()
throws Throwable { throws Throwable {
@ -736,20 +736,23 @@ public class EnvironmentTest extends DualTestCase {
File testEnvHome = null; File testEnvHome = null;
try { try {
/* StringBuilder testPropsEnv = new StringBuilder()
* A je.properties file has been put into .append(SharedTestUtils.getTestDir().getParent())
* <testdestdir>/propTest/je.properties .append(File.separatorChar)
*/ .append("propTest");
StringBuilder testPropsEnv = new StringBuilder();
testPropsEnv.append(SharedTestUtils.getTestDir().getParent());
testPropsEnv.append(File.separatorChar);
testPropsEnv.append("propTest");
testEnvHome = new File(testPropsEnv.toString()); 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", TestUtils.removeLogFiles("testParamLoading start",
testEnvHome, false); 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. * TestUtils.initEnvConfig since we're counting properties.
*/ */
EnvironmentConfig appConfig = new EnvironmentConfig(); 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.util.TestUtils;
import com.sleepycat.je.utilint.TestHook; import com.sleepycat.je.utilint.TestHook;
@Ignore
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class BackgroundIOTest extends CleanerTestBase { 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 * Tests that cleaner mutable configuration parameters can be changed and
* that the changes actually take effect. * that the changes actually take effect.
*/ */
@Ignore
@Test @Test
public void testMutableConfig() public void testMutableConfig()
throws DatabaseException { throws DatabaseException {
@ -1311,7 +1310,6 @@ public class CleanerTest extends CleanerTestBase {
* flushed. This feature (incremental update) was added so that log * flushed. This feature (incremental update) was added so that log
* cleaning is not delayed until the end of the checkpoint. [#16037] * cleaning is not delayed until the end of the checkpoint. [#16037]
*/ */
@Ignore
@Test @Test
public void testUtilizationDuringCheckpoint() public void testUtilizationDuringCheckpoint()
throws DatabaseException { 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 * occurring in JE 3.3.74 and earlier, under the same circumstances as
* tested here (IN compression). [#16610] * tested here (IN compression). [#16610]
*/ */
@Ignore
@Test @Test
public void testCompressionBug() public void testCompressionBug()
throws DatabaseException { throws DatabaseException {

View file

@ -40,7 +40,6 @@ import com.sleepycat.je.utilint.JVMSystemUtils;
import com.sleepycat.util.test.SharedTestUtils; import com.sleepycat.util.test.SharedTestUtils;
import org.junit.After; import org.junit.After;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
@ -67,8 +66,7 @@ public class ReadOnlyLockingTest extends CleanerTestBase {
private Process readerProcess; private Process readerProcess;
private static File getProcessFile() { private static File getProcessFile() {
return new File(System.getProperty(TestUtils.DEST_DIR), return SharedTestUtils.getDestDirChlid("ReadOnlyProcessFile");
"ReadOnlyProcessFile");
} }
private static void deleteProcessFile() { 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. * Tests that cleaned files are not deleted when there is a reader process.
*/ */
@Test @Test
@Ignore
public void testReadOnlyLocking() public void testReadOnlyLocking()
throws Exception { 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 * Tests that a log file is not deleted by the cleaner when it contains
* entries in a database that is pending deletion. * entries in a database that is pending deletion.
*/ */
@Ignore
@Test @Test
public void testDBPendingDeletion() public void testDBPendingDeletion()
throws DatabaseException, InterruptedException { 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 * deleted DBs to the cleaner's pending DB set if all entries in the log
* file were known obsoleted. [#13333] * file were known obsoleted. [#13333]
*/ */
@Ignore
@Test @Test
public void testObsoleteLogFile() public void testObsoleteLogFile()
throws DatabaseException, InterruptedException { throws DatabaseException, InterruptedException {

View file

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

View file

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

View file

@ -979,7 +979,6 @@ public class LogManagerTest extends TestBase {
testChecksumExReasonInternal("logbufferPersistent"); testChecksumExReasonInternal("logbufferPersistent");
} }
@Ignore
@Test @Test
public void testChecksumExReasonFileSource() public void testChecksumExReasonFileSource()
throws FileNotFoundException{ throws FileNotFoundException{
@ -1001,7 +1000,7 @@ public class LogManagerTest extends TestBase {
Trace smallTrace = new Trace("generate logbuffer"); Trace smallTrace = new Trace("generate logbuffer");
long lsn = Trace.trace(envImpl, smallTrace); long lsn = Trace.trace(envImpl, smallTrace);
/* Crash the logbuffer. */ /* Crash the logBuffer. */
try { try {
LogBuffer logBuffer = (LogBuffer) logManager.getLogSource(lsn); LogBuffer logBuffer = (LogBuffer) logManager.getLogSource(lsn);
ByteBuffer byteBuf = logBuffer.getBytes(DbLsn.getFileOffset(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 * perform a cursor operation. While the BIN is held, it attempts to get a
* non-blocking lock. * non-blocking lock.
*/ */
@Ignore
@Test @Test
public void testAbortLatchDeadlock() { public void testAbortLatchDeadlock() {

View file

@ -36,36 +36,8 @@ public class FileStoreInfoTest {
private final Logger logger = private final Logger logger =
LoggerUtils.getLoggerFixedPrefix(getClass(), "Test"); LoggerUtils.getLoggerFixedPrefix(getClass(), "Test");
/** Test when running on Java 6. */
@Ignore
@Test @Test
public void testJava6() public void testJava7andLater()
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()
throws Exception { throws Exception {
try { try {

View file

@ -37,7 +37,7 @@ public class SharedTestUtils {
public static String DEST_DIR = "testdestdir"; public static String DEST_DIR = "testdestdir";
public static String TEST_ENV_DIR = "testenvdirroot"; public static String TEST_ENV_DIR = "testenvdirroot";
public static String FAILURE_DIR = "failurecopydir"; 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_TEST_DIR_ROOT = "target/envdata";
public static String DEFAULT_FAIL_DIR = "target/failures"; public static String DEFAULT_FAIL_DIR = "target/failures";
public static String NO_SYNC = "txnnosync"; public static String NO_SYNC = "txnnosync";
@ -58,7 +58,18 @@ public class SharedTestUtils {
File file = new File(dir); File file = new File(dir);
if (!file.isDirectory()) if (!file.isDirectory())
file.mkdir(); file.mkdir();
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; return file;
} }