@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.TestRule
apply
in class org.junit.rules.ExternalResource
public void before() throws Exception
before
in class org.junit.rules.ExternalResource
Exception
public void after()
after
in class org.junit.rules.ExternalResource
public KuduClient getClient()
public AsyncKuduClient getAsyncClient()
public void killTabletLeader(KuduTable table) throws Exception
table
- a KuduTable which will get its single tablet's leader killed.Exception
public void killTabletLeader(org.apache.kudu.client.RemoteTablet tablet) throws Exception
tablet
- a RemoteTablet which will get its leader killedException
public void killTabletLeader(LocatedTablet tablet) throws Exception
tablet
- a LocatedTablet which will get its leader killedException
public 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 restartException
public void restartTabletServer(org.apache.kudu.client.RemoteTablet tablet) throws Exception
tablet
- a RemoteTablet which will get its leader killed and restartedException
public void restartLeaderMaster() throws Exception
Exception
public 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
IOException
public void startAllMasterServers() throws IOException
IOException
public void killAllTabletServers() throws IOException
IOException
public void startAllTabletServers() throws IOException
IOException
public void kdestroy() throws IOException
IOException
public void kinit(String username) throws IOException
username
- the username to kinit asIOException
public void resetClients() throws IOException
IOException