mirror of https://github.com/apache/cassandra
Lifecycle unit tests fail when run in parallel
patch by stefania; reviewed by benedict for CASSANDRA-9561
This commit is contained in:
parent
b0ae285bdc
commit
99a84bcafa
|
|
@ -21,7 +21,6 @@ package org.apache.cassandra;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
|
@ -88,7 +87,11 @@ public class MockSchema
|
|||
|
||||
public static SSTableReader sstable(int generation, int size, boolean keepRef, ColumnFamilyStore cfs)
|
||||
{
|
||||
Descriptor descriptor = new Descriptor(temp("mockcfdir").getParentFile(), ks.getName(), cfs.getColumnFamilyName(), generation, Descriptor.Type.FINAL);
|
||||
Descriptor descriptor = new Descriptor(cfs.directories.getDirectoryForNewSSTables(),
|
||||
cfs.keyspace.getName(),
|
||||
cfs.getColumnFamilyName(),
|
||||
generation,
|
||||
Descriptor.Type.FINAL);
|
||||
Set<Component> components = ImmutableSet.of(Component.DATA, Component.PRIMARY_INDEX, Component.FILTER, Component.TOC);
|
||||
for (Component component : components)
|
||||
{
|
||||
|
|
@ -100,7 +103,6 @@ public class MockSchema
|
|||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
file.deleteOnExit();
|
||||
}
|
||||
if (size > 0)
|
||||
{
|
||||
|
|
@ -132,13 +134,16 @@ public class MockSchema
|
|||
public static ColumnFamilyStore newCFS()
|
||||
{
|
||||
String cfname = "mockcf" + (id.incrementAndGet());
|
||||
CFMetaData metadata = newCFMetaData(cfname);
|
||||
CFMetaData metadata = newCFMetaData(ks.getName(), cfname);
|
||||
return new ColumnFamilyStore(ks, cfname, Murmur3Partitioner.instance, 0, metadata, new Directories(metadata), false, false);
|
||||
}
|
||||
|
||||
private static CFMetaData newCFMetaData(String cfname)
|
||||
private static CFMetaData newCFMetaData(String ksname, String cfname)
|
||||
{
|
||||
CFMetaData metadata = new CFMetaData("mockks", cfname, ColumnFamilyType.Standard, new SimpleSparseCellNameType(UTF8Type.instance));
|
||||
CFMetaData metadata = new CFMetaData(ksname,
|
||||
cfname,
|
||||
ColumnFamilyType.Standard,
|
||||
new SimpleSparseCellNameType(UTF8Type.instance));
|
||||
metadata.caching(CachingOptions.NONE);
|
||||
return metadata;
|
||||
}
|
||||
|
|
@ -169,7 +174,7 @@ public class MockSchema
|
|||
{
|
||||
File dir = new File(dirName);
|
||||
if (!dir.exists())
|
||||
throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
|
||||
continue;
|
||||
String[] children = dir.list();
|
||||
for (String child : children)
|
||||
FileUtils.deleteRecursive(new File(dir, child));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
|
@ -39,6 +40,12 @@ import org.apache.cassandra.utils.concurrent.Refs;
|
|||
public class HelpersTest
|
||||
{
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp()
|
||||
{
|
||||
MockSchema.cleanup();
|
||||
}
|
||||
|
||||
static Set<Integer> a = set(1, 2, 3);
|
||||
static Set<Integer> b = set(4, 5, 6);
|
||||
static Set<Integer> c = set(7, 8, 9);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
|||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
|
@ -53,6 +54,12 @@ public class LifecycleTransactionTest extends AbstractTransactionalTest
|
|||
{
|
||||
private boolean incrementalBackups;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp()
|
||||
{
|
||||
MockSchema.cleanup();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void disableIncrementalBackup()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.google.common.base.Function;
|
|||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
|
@ -43,6 +44,11 @@ import static org.apache.cassandra.db.lifecycle.Helpers.emptySet;
|
|||
|
||||
public class ViewTest
|
||||
{
|
||||
@BeforeClass
|
||||
public static void setUp()
|
||||
{
|
||||
MockSchema.cleanup();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSSTablesInBounds()
|
||||
|
|
|
|||
Loading…
Reference in New Issue