Skip to content

Commit

Permalink
Set ports to default when testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw9580 committed Aug 14, 2020
1 parent cd10274 commit c090a43
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public class IPFSGroupScan extends AbstractGroupScan {
private List<SchemaPath> columns;

private static final long DEFAULT_NODE_SIZE = 1000L;
private static final int DEFAULT_USER_PORT = 31010;
private static final int DEFAULT_CONTROL_PORT = 31011;
private static final int DEFAULT_DATA_PORT = 31012;
private static final int DEFAULT_HTTP_PORT = 8047;
public static final int DEFAULT_USER_PORT = 31010;
public static final int DEFAULT_CONTROL_PORT = 31011;
public static final int DEFAULT_DATA_PORT = 31012;
public static final int DEFAULT_HTTP_PORT = 8047;

private ListMultimap<Integer, IPFSWork> assignments;
private List<IPFSWork> ipfsWorkList = Lists.newArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
package org.apache.drill.exec.store.ipfs;


import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.store.StoragePluginRegistry;
import org.apache.drill.test.ClusterFixture;
import org.apache.drill.test.ClusterFixtureBuilder;
import org.apache.drill.test.ClusterTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Expand All @@ -34,7 +36,11 @@ public class IPFSTestBase extends ClusterTest {

@BeforeClass
public static void setUpBeforeClass() throws Exception {
startCluster(ClusterFixture.builder(dirTestWatcher));
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
builder.configProperty(ExecConstants.INITIAL_BIT_PORT, IPFSGroupScan.DEFAULT_CONTROL_PORT);
builder.configProperty(ExecConstants.INITIAL_DATA_PORT, IPFSGroupScan.DEFAULT_DATA_PORT);
builder.configProperty(ExecConstants.INITIAL_USER_PORT, IPFSGroupScan.DEFAULT_USER_PORT);
startCluster(builder);
pluginRegistry = cluster.drillbit().getContext().getStorage();

IPFSTestSuit.initIPFS();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.ipfs.multihash.Multihash;
import org.apache.drill.categories.IPFSStorageTest;
import org.apache.drill.categories.SlowTest;
import org.apache.drill.exec.proto.CoordinationProtos;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -32,8 +34,23 @@
@Category({SlowTest.class, IPFSStorageTest.class})
public class TestIPFSQueries extends IPFSTestBase {

@Before
public void checkDrillbitPorts() {
CoordinationProtos.DrillbitEndpoint ep = cluster.drillbit().getRegistrationHandle().getEndPoint();
int controlPort = ep.getControlPort();
int userPort = ep.getUserPort();
int dataPort = ep.getDataPort();
if (controlPort != IPFSGroupScan.DEFAULT_CONTROL_PORT
|| userPort != IPFSGroupScan.DEFAULT_USER_PORT
|| dataPort != IPFSGroupScan.DEFAULT_DATA_PORT) {
//DRILL-7754 handle non-default ports
fail(String.format("Drill binded to non-default ports: %d, %d, %d", controlPort, userPort, dataPort));
}
}

@Test
public void testNullQuery() throws Exception {

testBuilder()
.sqlQuery(getSelectStar(IPFSHelper.IPFS_NULL_OBJECT))
.unOrdered()
Expand Down

0 comments on commit c090a43

Please sign in to comment.