Skip to content

Commit

Permalink
Fix or mark single-threaded all tests with @BeforeMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Feb 21, 2018
1 parent 6af79a3 commit e72afda
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 32 deletions.
Expand Up @@ -17,23 +17,15 @@
import com.facebook.presto.spi.predicate.TupleDomain; import com.facebook.presto.spi.predicate.TupleDomain;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import io.airlift.json.JsonCodec; import io.airlift.json.JsonCodec;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;


import static io.airlift.json.JsonCodec.jsonCodec; import static io.airlift.json.JsonCodec.jsonCodec;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;


public class TestLocalFileSplit public class TestLocalFileSplit
{ {
private HostAddress address; private final HostAddress address = HostAddress.fromParts("localhost", 1234);
private LocalFileSplit split; private final LocalFileSplit split = new LocalFileSplit(address, LocalFileTables.HttpRequestLogTable.getSchemaTableName(), TupleDomain.all());

@BeforeMethod
public void setUp()
{
address = HostAddress.fromParts("localhost", 1234);
split = new LocalFileSplit(address, LocalFileTables.HttpRequestLogTable.getSchemaTableName(), TupleDomain.all());
}


@Test @Test
public void testJsonRoundTrip() public void testJsonRoundTrip()
Expand Down
Expand Up @@ -13,20 +13,20 @@
*/ */
package com.facebook.presto.cost; package com.facebook.presto.cost;


import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;


public abstract class BaseStatsCalculatorTest public abstract class BaseStatsCalculatorTest
{ {
private StatsCalculatorTester tester; private StatsCalculatorTester tester;


@BeforeMethod @BeforeClass
public void setUp() public void setUp()
{ {
tester = new StatsCalculatorTester(); tester = new StatsCalculatorTester();
} }


@AfterMethod @AfterClass
public void tearDown() public void tearDown()
{ {
tester.close(); tester.close();
Expand Down
Expand Up @@ -25,7 +25,7 @@
import com.facebook.presto.sql.tree.StringLiteral; import com.facebook.presto.sql.tree.StringLiteral;
import com.facebook.presto.sql.tree.SymbolReference; import com.facebook.presto.sql.tree.SymbolReference;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;


import java.util.Map; import java.util.Map;
Expand All @@ -39,15 +39,14 @@
import static java.lang.Double.NaN; import static java.lang.Double.NaN;
import static java.lang.Double.POSITIVE_INFINITY; import static java.lang.Double.POSITIVE_INFINITY;


@Test(singleThreaded = true)
public class TestComparisonStatsCalculator public class TestComparisonStatsCalculator
{ {
private FilterStatsCalculator filterStatsCalculator; private FilterStatsCalculator filterStatsCalculator;
private Session session; private Session session;
private PlanNodeStatsEstimate standardInputStatistics; private PlanNodeStatsEstimate standardInputStatistics;
private Map<Symbol, Type> types; private Map<Symbol, Type> types;


@BeforeMethod @BeforeClass
public void setUp() public void setUp()
throws Exception throws Exception
{ {
Expand Down
Expand Up @@ -31,7 +31,7 @@
import com.facebook.presto.sql.tree.SymbolReference; import com.facebook.presto.sql.tree.SymbolReference;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;


import java.util.Map; import java.util.Map;
Expand All @@ -45,15 +45,14 @@
import static java.lang.Double.NaN; import static java.lang.Double.NaN;
import static java.lang.Double.POSITIVE_INFINITY; import static java.lang.Double.POSITIVE_INFINITY;


@Test(singleThreaded = true)
public class TestFilterStatsCalculator public class TestFilterStatsCalculator
{ {
private FilterStatsCalculator statsCalculator; private FilterStatsCalculator statsCalculator;
private PlanNodeStatsEstimate standardInputStatistics; private PlanNodeStatsEstimate standardInputStatistics;
private Map<Symbol, Type> standardTypes; private Map<Symbol, Type> standardTypes;
private Session session; private Session session;


@BeforeMethod @BeforeClass
public void setUp() public void setUp()
throws Exception throws Exception
{ {
Expand Down Expand Up @@ -130,7 +129,7 @@ public void setUp()
statsCalculator = new FilterStatsCalculator(MetadataManager.createTestMetadataManager()); statsCalculator = new FilterStatsCalculator(MetadataManager.createTestMetadataManager());
} }


public PlanNodeStatsAssertion assertExpression(Expression expression) private PlanNodeStatsAssertion assertExpression(Expression expression)
{ {
return PlanNodeStatsAssertion.assertThat(statsCalculator.filterStats(standardInputStatistics, return PlanNodeStatsAssertion.assertThat(statsCalculator.filterStats(standardInputStatistics,
expression, expression,
Expand Down
Expand Up @@ -20,7 +20,6 @@
import static com.facebook.presto.spi.type.DoubleType.DOUBLE; import static com.facebook.presto.spi.type.DoubleType.DOUBLE;
import static java.lang.Double.POSITIVE_INFINITY; import static java.lang.Double.POSITIVE_INFINITY;


@Test(singleThreaded = true)
public class TestOutputNodeStats public class TestOutputNodeStats
extends BaseStatsCalculatorTest extends BaseStatsCalculatorTest
{ {
Expand Down
Expand Up @@ -24,7 +24,7 @@
import com.facebook.presto.sql.tree.NullLiteral; import com.facebook.presto.sql.tree.NullLiteral;
import com.facebook.presto.sql.tree.StringLiteral; import com.facebook.presto.sql.tree.StringLiteral;
import com.facebook.presto.sql.tree.SymbolReference; import com.facebook.presto.sql.tree.SymbolReference;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;


import static com.facebook.presto.cost.PlanNodeStatsEstimate.UNKNOWN_STATS; import static com.facebook.presto.cost.PlanNodeStatsEstimate.UNKNOWN_STATS;
Expand All @@ -39,7 +39,7 @@ public class TestScalarStatsCalculator
private Session session; private Session session;
private final SqlParser sqlParser = new SqlParser(); private final SqlParser sqlParser = new SqlParser();


@BeforeMethod @BeforeClass
public void setUp() public void setUp()
{ {
calculator = new ScalarStatsCalculator(MetadataManager.createTestMetadataManager()); calculator = new ScalarStatsCalculator(MetadataManager.createTestMetadataManager());
Expand Down
Expand Up @@ -23,7 +23,6 @@
import static com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder.expression; import static com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder.expression;
import static com.facebook.presto.type.UnknownType.UNKNOWN; import static com.facebook.presto.type.UnknownType.UNKNOWN;


@Test(singleThreaded = true)
public class TestValuesNodeStats public class TestValuesNodeStats
extends BaseStatsCalculatorTest extends BaseStatsCalculatorTest
{ {
Expand Down
Expand Up @@ -21,6 +21,7 @@
import static io.airlift.units.DataSize.Unit.MEGABYTE; import static io.airlift.units.DataSize.Unit.MEGABYTE;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;


@Test(singleThreaded = true)
public class TestSpillSpaceTracker public class TestSpillSpaceTracker
{ {
private static final DataSize MAX_DATA_SIZE = new DataSize(10, MEGABYTE); private static final DataSize MAX_DATA_SIZE = new DataSize(10, MEGABYTE);
Expand Down
Expand Up @@ -28,7 +28,7 @@
import com.facebook.presto.tpch.TpchTableLayoutHandle; import com.facebook.presto.tpch.TpchTableLayoutHandle;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;


import java.util.Map; import java.util.Map;
Expand All @@ -46,13 +46,13 @@
public class TestPickTableLayout public class TestPickTableLayout
extends BaseRuleTest extends BaseRuleTest
{ {
protected PickTableLayout pickTableLayout; private PickTableLayout pickTableLayout;
private TableHandle nationTableHandle; private TableHandle nationTableHandle;
private TableLayoutHandle nationTableLayoutHandle; private TableLayoutHandle nationTableLayoutHandle;
protected ConnectorId connectorId; private ConnectorId connectorId;


@BeforeMethod @BeforeClass
public void setUpPerMethod() public void setUpBeforeClass()
{ {
pickTableLayout = new PickTableLayout(tester().getMetadata()); pickTableLayout = new PickTableLayout(tester().getMetadata());


Expand Down
Expand Up @@ -34,7 +34,7 @@
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import io.airlift.json.ObjectMapperProvider; import io.airlift.json.ObjectMapperProvider;
import io.airlift.slice.Slice; import io.airlift.slice.Slice;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;


import java.util.Map; import java.util.Map;
Expand Down Expand Up @@ -70,7 +70,7 @@ Slice.class, new SliceDeserializer(),
objectMapper = provider.get(); objectMapper = provider.get();
} }


@BeforeMethod @BeforeClass
public void setUp() public void setUp()
{ {
symbolAllocator = new SymbolAllocator(); symbolAllocator = new SymbolAllocator();
Expand Down
Expand Up @@ -27,6 +27,7 @@
import io.airlift.node.testing.TestingNodeModule; import io.airlift.node.testing.TestingNodeModule;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;


import javax.inject.Singleton; import javax.inject.Singleton;


Expand All @@ -40,6 +41,7 @@
import static com.google.inject.util.Modules.override; import static com.google.inject.util.Modules.override;
import static io.airlift.jaxrs.JaxrsBinder.jaxrsBinder; import static io.airlift.jaxrs.JaxrsBinder.jaxrsBinder;


@Test(singleThreaded = true)
public class TestHttpBackupStore public class TestHttpBackupStore
extends AbstractTestBackupStore<BackupStore> extends AbstractTestBackupStore<BackupStore>
{ {
Expand Down
Expand Up @@ -57,6 +57,7 @@
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;


@Test(singleThreaded = true)
public class TestShardEjector public class TestShardEjector
{ {
private IDBI dbi; private IDBI dbi;
Expand Down
Expand Up @@ -59,6 +59,7 @@
import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE; import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;


@Test(singleThreaded = true)
public class TestShardOrganizerUtil public class TestShardOrganizerUtil
{ {
private static final List<ColumnInfo> COLUMNS = ImmutableList.of( private static final List<ColumnInfo> COLUMNS = ImmutableList.of(
Expand Down

0 comments on commit e72afda

Please sign in to comment.