@InterfaceAudience.Public
@InterfaceStability.Evolving
public class KuduTestHarness
extends org.junit.rules.ExternalResource
public static class TestFoo {
@Rule
public KuduTestHarness harness = new KuduTestHarness();
...
}
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_SLEEP |
| Constructor and Description |
|---|
KuduTestHarness() |
KuduTestHarness(org.apache.kudu.test.cluster.MiniKuduCluster.MiniKuduClusterBuilder clusterBuilder) |
| Modifier and Type | Method and Description |
|---|---|
void |
after() |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
void |
before() |
org.apache.kudu.client.HostAndPort |
findLeaderMasterServer()
Find the host and port of the leader master.
|
org.apache.kudu.client.HostAndPort |
findLeaderTabletServer(LocatedTablet tablet)
Finds the RPC port of the given tablet's leader tserver.
|
AsyncKuduClient |
getAsyncClient() |
static org.apache.kudu.test.cluster.MiniKuduCluster.MiniKuduClusterBuilder |
getBaseClusterBuilder()
Returns the base MiniKuduClusterBuilder used when creating a
KuduTestHarness with the default constructor.
|
KuduClient |
getClient() |
String |
getClusterRoot() |
String |
getMasterAddressesAsString()
Return the comma-separated list of "host:port" pairs that describes the master
config for this cluster.
|
List<org.apache.kudu.client.HostAndPort> |
getMasterServers() |
List<org.apache.kudu.client.HostAndPort> |
getTabletServers() |
void |
kdestroy()
Removes all credentials for all principals from the Kerberos credential cache.
|
void |
killAllMasterServers()
Kills all the master servers.
|
void |
killAllTabletServers()
Kills all the tablet servers.
|
void |
killLeaderMasterServer()
Helper method to easily kill the leader master.
|
void |
killTabletLeader(KuduTable table)
Helper method to easily kill a tablet server that serves the given table's only tablet's
leader.
|
void |
killTabletLeader(LocatedTablet tablet)
Helper method to kill a tablet server that serves the given tablet's
leader.
|
void |
killTabletLeader(org.apache.kudu.client.RemoteTablet tablet)
Helper method to kill a tablet server that serves the given tablet's
leader.
|
void |
kinit(String username)
Re-initialize Kerberos credentials for the given username, writing them
into the Kerberos credential cache.
|
void |
resetClients()
Resets the clients so that their state is completely fresh, including meta
cache, connections, open tables, sessions and scanners, and propagated timestamp.
|
void |
restartLeaderMaster()
Kills and restarts the leader master.
|
void |
restartTabletServer(KuduTable table)
Picks at random a tablet server that serves tablets from the passed table and restarts it.
|
void |
restartTabletServer(org.apache.kudu.client.RemoteTablet tablet)
Kills a tablet server that serves the given tablet's leader and restarts it.
|
void |
startAllMasterServers()
Starts all the master servers.
|
void |
startAllTabletServers()
Starts all the tablet servers.
|
public static final int DEFAULT_SLEEP
public KuduTestHarness(org.apache.kudu.test.cluster.MiniKuduCluster.MiniKuduClusterBuilder clusterBuilder)
public KuduTestHarness()
public static org.apache.kudu.test.cluster.MiniKuduCluster.MiniKuduClusterBuilder getBaseClusterBuilder()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRuleapply in class org.junit.rules.ExternalResourcepublic void before()
throws Exception
before in class org.junit.rules.ExternalResourceExceptionpublic void after()
after in class org.junit.rules.ExternalResourcepublic KuduClient getClient()
public AsyncKuduClient getAsyncClient()
public void killTabletLeader(KuduTable table) throws Exception
table - a KuduTable which will get its single tablet's leader killed.Exceptionpublic void killTabletLeader(org.apache.kudu.client.RemoteTablet tablet)
throws Exception
tablet - a RemoteTablet which will get its leader killedExceptionpublic void killTabletLeader(LocatedTablet tablet) throws Exception
tablet - a LocatedTablet which will get its leader killedExceptionpublic org.apache.kudu.client.HostAndPort findLeaderTabletServer(LocatedTablet tablet) throws Exception
tablet - a LocatedTabletException - if we are unable to find the leader tserverpublic void killLeaderMasterServer()
throws Exception
Exception - if there is an error finding or killing the leader master.public org.apache.kudu.client.HostAndPort findLeaderMasterServer()
throws Exception
Exception - if we are unable to find the leader masterpublic void restartTabletServer(KuduTable table) throws Exception
table - table to query for a TS to restartExceptionpublic void restartTabletServer(org.apache.kudu.client.RemoteTablet tablet)
throws Exception
tablet - a RemoteTablet which will get its leader killed and restartedExceptionpublic void restartLeaderMaster()
throws Exception
Exceptionpublic String getMasterAddressesAsString()
public List<org.apache.kudu.client.HostAndPort> getMasterServers()
public List<org.apache.kudu.client.HostAndPort> getTabletServers()
public String getClusterRoot()
public void killAllMasterServers()
throws IOException
IOExceptionpublic void startAllMasterServers()
throws IOException
IOExceptionpublic void killAllTabletServers()
throws IOException
IOExceptionpublic void startAllTabletServers()
throws IOException
IOExceptionpublic void kdestroy()
throws IOException
IOExceptionpublic void kinit(String username) throws IOException
username - the username to kinit asIOExceptionpublic void resetClients()
throws IOException
IOException